Error SQL Syntax

Asked

Viewed 37 times

-1

I’m trying to edit a table in my database and create a fk

Query:

ALTER TABLE `tcc`.`usuarios` ADD INDEX `fk_playlist_idx` (`id_playlist` ASC) VISIBLE; ALTER TABLE `tcc`.`usuarios` ADD CONSTRAINT `fk_playlist`  FOREIGN KEY (`id_playlist`)  REFERENCES `tcc`.`playlist` (`codigo`);

ERROR:

Error Code: 1064. 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 '' at line 1

It must be a very stupid mistake, but I’m new in this area

  • He mentioned that he is trying to create a table, but put the command alter table. It is unclear when the error occurs.

  • yes in this part I missed, only that I’m trying to create a fk, q I mean, only that returns me this error

  • 1

    Done, one of my first stack overflow visits

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.