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 (10 records each table) and have 10 Query questions. Query questions must include 2 joining of tables, subqueries, 2 aggregate functions, etc.
CREATE TABLE Service (
ServiceID INT PRIMARY KEY,
ServiceName VARCHAR(255),
Amount FLOAT
);
CREATE TABLE Customer (
CustomerID INT PRIMARY KEY,
FirstName VARCHAR(255),
LastName VARCHAR(255),
Gender CHAR(1)
);
CREATE TABLE Payment (
PaymentID INT PRIMARY KEY,
PaymentType VARCHAR(50),
TotalAmount FLOAT,
LitersAmount FLOAT,
PetrolRate FLOAT
);
CREATE TABLE Staff (
StaffID INT PRIMARY KEY,
Name VARCHAR(255)
);
CREATE TABLE Customer_Service (
CustomerID INT,
StaffID INT,
ServiceID INT,
PaymentID INT,
TransactionDate DATE,
PropertyStation VARCHAR(255),
PRIMARY KEY (CustomerID, StaffID, ServiceID, PaymentID),
CONSTRAINT fk1 FOREIGN KEY (CustomerID) REFERENCES Customer(CustomerID),
CONSTRAINT fk2 FOREIGN KEY (StaffID) REFERENCES Staff(StaffID),
CONSTRAINT fk3 FOREIGN KEY (ServiceID) REFERENCES Service(ServiceID),
CONSTRAINT fk4 FOREIGN KEY (PaymentID) REFERENCES Payment(PaymentID)
);

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 Accounting Questions!