Where are my SQL syntax errors? MariaDB [(none)]> Drop database if exists moviedb; Query OK, 1 row affected (0.040 sec) MariaDB [(none)]> MariaDB [(none)]> Create database moviedb; Query OK, 1 row affected (0.001 sec) MariaDB [(none)]> MariaDB [(none)]> use moviedb; Database changed MariaDB [moviedb]> MariaDB [moviedb]> Create table customer -> ( -> ID varChar(30), -> Password varChar(20), -> Phone varChar(13), -> constraint customer_PK primary key (ID) -> ); Query OK, 0 rows affected, 1 warning (0.031 sec) MariaDB [moviedb]> Create table Ticket -> ( -> ticketNum Number, -> MovieName varChar(30), -> Length Number, -> Director varChar(20), -> ShowTime varChar(30), -> -> constraint Ticket_PK primary key (ticketNum) -> constraint Ticket_FK foreign key (ShowTime) references ShowDate(ShowTime) -> ); ERROR 1064 (42000): 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 ' MovieName varChar(30), Length Number, Director varChar(20), ...' at line 3 MariaDB [moviedb]> Create table purchase -> ( -> ID varChar(30), -> ticketNum Number, -> -> constraint purchase_PK primary key (ID,ticketNum), -> constraint purchase_FK foreign key(ID) references customer(ID), -> constraint purchase_FK foreign key(ticketNum) references Ticket(ticketNum) -> ); ERROR 1064 (42000): 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 purchase_PK primary key (ID,ticketNum), constraint purchas...' at line 4 MariaDB [moviedb]> Create table ShowDate -> ( -> ShowTime varChar(30), -> seat varChar(5), -> price Number, -> constraint ShowDate_PK primary key(ShowTime) -> -> ); ERROR 1064 (42000): 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 ShowDate_PK primary key(ShowTime) )' at line 5
Where are my SQL syntax errors?
MariaDB [(none)]> Drop
Query OK, 1 row affected (0.040 sec)
MariaDB [(none)]>
MariaDB [(none)]> Create database moviedb;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]>
MariaDB [(none)]> use moviedb;
Database changed
MariaDB [moviedb]>
MariaDB [moviedb]> Create table customer
-> (
-> ID varChar(30),
-> Password varChar(20),
-> Phone varChar(13),
-> constraint customer_PK primary key (ID)
-> );
Query OK, 0 rows affected, 1 warning (0.031 sec)
MariaDB [moviedb]> Create table Ticket
-> (
-> ticketNum Number,
-> MovieName varChar(30),
-> Length Number,
-> Director varChar(20),
-> ShowTime varChar(30),
->
-> constraint Ticket_PK primary key (ticketNum)
-> constraint Ticket_FK foreign key (ShowTime) references ShowDate(ShowTime)
-> );
ERROR 1064 (42000): 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 '
MovieName varChar(30),
Length Number,
Director varChar(20),
...' at line 3
MariaDB [moviedb]> Create table purchase
-> (
-> ID varChar(30),
-> ticketNum Number,
->
-> constraint purchase_PK primary key (ID,ticketNum),
-> constraint purchase_FK foreign key(ID) references customer(ID),
-> constraint purchase_FK foreign key(ticketNum) references Ticket(ticketNum)
-> );
ERROR 1064 (42000): 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 purchase_PK primary key (ID,ticketNum),
constraint purchas...' at line 4
MariaDB [moviedb]> Create table ShowDate
-> (
-> ShowTime varChar(30),
-> seat varChar(5),
-> price Number,
-> constraint ShowDate_PK primary key(ShowTime)
->
-> );
ERROR 1064 (42000): 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 ShowDate_PK primary key(ShowTime)
)' at line 5
Step by step
Solved in 3 steps with 1 images