Question: what can i fix this sql code and make it work ( keep the columns the same ) - - table 1 : Staff CREATE

what can i fix this sql code and make it work (keep the columns the same)
-- table 1: Staff
CREATE TABLE Staff (
EmployeeID INT PRIMARY KEY,
FirstName VARCHAR(50),
LastName VARCHAR(50),
PhoneNumber VARCHAR(20),
Email VARCHAR(100)
);
--table 2: Service
CREATE TABLE Service (
ServiceID INT PRIMARY KEY,
PetrolFilling VARCHAR(50),
GlassCleaning VARCHAR(50),
CarWash VARCHAR(50),
CarTankFilter VARCHAR(50),
PaymentID INT,
FOREIGN KEY (PaymentID) REFERENCES Payment(PaymentID)
);
-- table 3: Payment
CREATE TABLE Payment (
PaymentID INT PRIMARY KEY,
PaymentType VARCHAR(50),
TotalAmount DECIMAL(10,2),
LiterAmount DECIMAL(10,2),
PetrolRate DECIMAL(10,2),
CustomerID INT,
AccountID INT,
FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID),
FOREIGN KEY (AccountID) REFERENCES Customer(AccountID)
);
-- table 4: Property
CREATE TABLE Property (
PropertyID INT PRIMARY KEY,
Location VARCHAR(100),
BuildingNumber VARCHAR(50),
City VARCHAR(50),
Country VARCHAR(50)
);
--table 5: Customer
CREATE TABLE Customer (
CustomerID INT PRIMARY KEY,
AccountID INT,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Gender VARCHAR(10),
PaymentID INT,
FOREIGN KEY (PaymentID) REFERENCES Payment(PaymentID)
);
-- table 6:junction Staff_Service
CREATE TABLE Staff_Service (
EmployeeID INT,
ServiceID INT,
FOREIGN KEY (EmployeeID) REFERENCES Staff(EmployeeID),
FOREIGN KEY (ServiceID) REFERENCES Service(ServiceID),
PRIMARY KEY (EmployeeID, ServiceID)
);
-- junction table Customer_Service
CREATE TABLE Customer_Service (
CustomerID INT,
AccountID INT,
ServiceID INT,
FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID),
FOREIGN KEY (AccountID) REFERENCES Customer(AccountID),
FOREIGN KEY (ServiceID) REFERENCES Service(ServiceID),
PRIMARY KEY (CustomerID, AccountID, ServiceID)
);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!