Search code examples
sqlmysqlphpmyadminsyntax-error

What do "near "CASCADE"" and "near "CONSTRAINTS" error mean in MySQL?


I apologise for the incorrect use of sql terms, I'm still a novice. So, I produced a ddl script from a relational model, converted it to MySQL and tried to "run" (the app Im' running it at is called phpMyAdmin) it but whatever I did was met with failure as these error kept occuring:

Unrecognized keyword. (near "CASCADE" at position 203) Unexpected presumption. (near "CONSTRAINTS" at position 211)

If anybody has a word of advice I'd gladly accept it. I'll provide the actual line of code that the error occures (which is the first line of the script too):

DROP TABLE ad CASCADE CONSTRAINTS;

The script is for a database. I tried to "reverse enngineer" it in the entity model and priduce a different script but the same error kept occuring.


Solution

  • @Brad Troll Error means keywords " Cascade" and "Constraint" are unrecognized as they are used to delete all rows from the child table once all tables from the parent table are deleted.

    Try using the code :

    DROP TABLE ad;

    It will run and will not give you any error.