hello everyone,
so i am new in sql and i would like some help.

i wanna create a table with foreign key but it gives me an error which i can't fix.

i wrote : foreign key(id_w) references waiter(id_w)

waiter is the table in which id_w is a primary key

and i wanna put id_w as a foreign key in talbe customer_t.

and it gives an error that can't create the table in MySQL 5.5 command line.

thank you in advance!

Show the complete CREATE TABLE statement.
Make sure that both waiter.id_w and customer_1.id_w have an index. The InnoDB engine needs an index on all fields which are used in a foreign key relation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.