skip to Main Content

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.

2

Answers


  1. From the MySQL docs we can see that your command syntax is illegal.

    In fact in MySQL you can’t delete on cascade like you want to do it :

    RESTRICT and CASCADE are allowed to make porting from other database systems easier. In MariaDB, they do nothing.

    Hope it help you.

    Login or Signup to reply.
  2. @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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search