Skip to content
Advertisement

SQL syntax with FOREIGN KEY

I have the following tables:

and it thow a err:- You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘CONSTRAINT fs_rppermission FOREIGN KEY

what’s the problem?

Advertisement

Answer

Consider:

Rationale:

  • there are missing commas all over your statement

  • the name of the foreign should not be surrounded with parentheses

  • … proper formatting makes the statement easier to write and read

Demo on DB Fiddle

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement