Question: For this sql code below inserted records per table ( 1 0 records each table ) and have 1 0 Query questions. Query questions must
For this sql code below inserted records per table records each table and have Query questions. Query questions must include joining of tables, subqueries, aggregate functions, etc.
CREATE TABLE Service
ServiceID INT PRIMARY KEY,
ServiceName VARCHAR
Amount FLOAT
;
CREATE TABLE Customer
CustomerID INT PRIMARY KEY,
FirstName VARCHAR
LastName VARCHAR
Gender CHAR
;
CREATE TABLE Payment
PaymentID INT PRIMARY KEY,
PaymentType VARCHAR
TotalAmount FLOAT,
LitersAmount FLOAT,
PetrolRate FLOAT
;
CREATE TABLE Staff
StaffID INT PRIMARY KEY,
Name VARCHAR
;
CREATE TABLE CustomerService
CustomerID INT,
StaffID INT,
ServiceID INT,
PaymentID INT,
TransactionDate DATE,
PropertyStation VARCHAR
PRIMARY KEY CustomerID StaffID, ServiceID, PaymentID
CONSTRAINT fk FOREIGN KEY CustomerID REFERENCES CustomerCustomerID
CONSTRAINT fk FOREIGN KEY StaffID REFERENCES StaffStaffID
CONSTRAINT fk FOREIGN KEY ServiceID REFERENCES ServiceServiceID
CONSTRAINT fk FOREIGN KEY PaymentID REFERENCES PaymentPaymentID
;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
