0
I need to create a SELECT which contain only records of a value x onwards. For example, return only movies with number of copies greater than 5
My Select
router.get('/filmes', (req, res) =>{
execSQLQuery('SELECT IF(copias > 5) from filmes', res);
});
Table Films
CREATE TABLE filme(
id int not null Primary Key Auto_Increment,
titulo varchar(255) not null,
diretor varchar(255) not null,
copias int not null
);
Error returned in Insomnia
{
"code": "ER_PARSE_ERROR",
"errno": 1064,
"sqlMessage": "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') from filmes' at line 1",
"sqlState": "42000",
"index": 0,
"sql": "SELECT IF(copias > 5) from filmes"
}
SELECT * FROM filmes WHERE copias > 5
– Math