Karthik Hegadi
Karthik Hegadi

Reputation: 3

MySQL syntax Error on create table query?

it leads to error in mysql

create table book_copies
(
   bookid references book(bookid) on delete set null,  
   programme_id references library_branch(programme_id) on delete set null, 
   no_of_copies int
);

enter image description here a

Upvotes: 0

Views: 60

Answers (1)

Schwern
Schwern

Reputation: 164629

You are lacking types for your columns. Each column needs a type such as int or varchar(255).

If your columns are referencing primary keys, their type is probably int or bigint.

create table book_copies (
  bookid int references book(bookid) on delete set null,
  programme_id int references library_branch(programme_id) on delete set null,
  no_of_copies int
)

Upvotes: 1

Related Questions