Hi, I am still trying to figure out what is caused the error of relation “table_name” does not exist…
The course is on this url:
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
This problem is on the step 8.
Here is my code:
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 char(2) REFERENCES category(id),
dish_id integer REFERENCES dish(id),
price money,
PRIMARY KEY (category_id, dish_id)
);
SELECT constraint_name, column_name, table_name
FROM information_schema.key_column_usage
WHERE table_name = 'categories_dishes';
The specific error said:
ERROR: relation “categories_dishes” does not exist
LINE 1: INSERT INTO categories_dishes VALUES (
I’ve spent hours to search on this discussion but never make this works.
Kindly need your help to solve this error.
Thank you,