I am using NodeJS with mysql for working with SQL database.
For school example I want to simulate SQL injection.
I wrote code with possible SQL injection:
const mysql = require('mysql')
const connection = mysql.createConnection({
    host: settings.DB_MYSQL_HOST,
    user: settings.DB_MYSQL_USER,
    password: settings.DB_MYSQL_PSW,
    database: settings.DB_MYSQL_DB,
})
let sql = 'DROP TABLE user;'
connection.query('DELETE FROM todos WHERE id = \'' + sql + '\'', (error) => {
                if (error) {
                    res.json({ res: error })
                    console.log('SQL ERROR')
                    console.log(error)
                    throw error
                }
                this._sendSucc(res)
})
But SQL injection not working. I want attack to table name 'user'.
Where is a problem? I am not using prepare statement.
Can you give me a example with SQL injection