drop table Employee;
CREATE TABLE Employee
( EmployeeID integer,
FirstName varchar(24),
LastName varchar(24),
Email varchar(48),
PhoneNumber varchar(12),
HotelID integer
PRIMARY KEY (EmployeeID),
);
INSERT INTO Employee VALUES (1, ‘James’, ‘Jenkins’, ‘jj@gmail.com’, ’0412181111’, 1);
INSERT INTO Employee VALUES (22, ‘Roy’, ‘Bond’, ‘jb@gmail.com’, ‘0418246192’, 1);
INSERT INTO Employee VALUES (14, ‘Rachel’, ‘Green’, ‘rg@gmail.com’, ‘0468129367’, 1);
INSERT INTO Employee VALUES (96, ‘Eddard’, ‘Stark’, ‘es@gmail.com’, ‘0458192716’, 1);
INSERT INTO Employee VALUES (77, ‘Anna’, ‘Nguyen’, ‘an@gmail.com’ , ‘0418238694’, 1);
Error: "psql:employee:1: ERROR: table "employee" does not exist"
What is the way that the error can be fixed?
Link to the entire doc if anyone wants to take a look: https://docs.google.com/document/d/1r4E7yz4XJxLmO3rmkH4YBVOGfYN5PkhcDSJUyuy7qxw/edit?usp=sharing
Your create statement has a comma(,) missing before declaring the primary key. Therefore the table is not getting created. This this:
CREATE TABLE Employee
( EmployeeID integer,
FirstName varchar(24),
LastName varchar(24),
Email varchar(48),
PhoneNumber varchar(12),
HotelID integer,
PRIMARY KEY (EmployeeID),
FOREIGN KEY (HotelID) REFERENCES Hotel
);
The table Employee
might not be already created in your database when you are trying to run above snippet. Always have an IF EXISTS check before dropping a table or stored procedure or function.
Your drop query should be.
drop table if exists `Employee`;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.