Hello,
I have some issues getting on with the Build A Menu For Bytes Of China project - https://www.codecademy.com/paths/design-databases-with-postgresql/tracks/how-do-i-make-and-populate-my-own-database/modules/designing-a-database-schema/projects/restaurant-database-project-with-postgresql.
Specifically my issue is with step 8 and creating the many-to-many table categories_dishes.
My code to create the tables
create table restaurant (
id integer PRIMARY KEY,
name varchar(20),
description varchar(100),
rating decimal,
telephone char(10),
hours varchar(100)
);
create table address(
id integer PRIMARY KEY,
street_number varchar(10),
street_name varchar(20),
city varchar(20),
state varchar(15),
google_map_link varchar(50),
restaurant_id integer REFERENCES restaurant(id)
);
create table category (
id char(2) PRIMARY KEY,
name varchar(20),
description varchar(200)
);
create table dish (
id integer PRIMARY KEY,
name varchar(50),
description varchar(200),
hot_and_spicy boolean
);
create table review (
id integer PRIMARY KEY,
rating decimal,
description varchar(100),
date date,
restaurant_id integer REFERENCES restaurant(id)
);
create table categories_dishes (
category_id REFERENCES category(id),
dish_id REFERENCES dish(id),
price money,
PRIMARY KEY (category_id, dish_id)
);
the values to insert
INSERT INTO categories_dishes VALUES (
'C',
1,
6.95
);
INSERT INTO categories_dishes VALUES (
'C',
3,
6.95
);
INSERT INTO categories_dishes VALUES (
'LS',
1,
8.95
);
INSERT INTO categories_dishes VALUES (
'LS',
4,
8.95
);
INSERT INTO categories_dishes VALUES (
'LS',
5,
8.95
);
INSERT INTO categories_dishes VALUES (
'HS',
6,
15.95
);
INSERT INTO categories_dishes VALUES (
'HS',
7,
16.95
);
INSERT INTO categories_dishes VALUES (
'HS',
8,
17.95
);
and the error message i’m getting
ERROR: syntax error at or near “REFERENCES”
LINE 2: category_id REFERENCES category(id),
any suggestions into what i’m doing wrong is greatly appreciated - also please let me know if i let out any important information!