0

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.

Brad Troll
  • 13
  • 3

2 Answers2

0

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.

Cortard
  • 72
  • 5
  • Thank you kindly! Do you have any suggestion for what to do next, or how to "fix" it? I realize it probably is very elementary, but I would appreciate it. Either way, thank you for answering my question! – Brad Troll Jun 01 '23 at 11:19
  • With pleasure, maybe [this](https://stackoverflow.com/questions/4858488/sql-server-drop-table-cascade-equivalent) can help you – Cortard Jun 01 '23 at 12:29
0

@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.

Jack D
  • 109
  • 7