Car Showroom
DataBase Carshowroom
@kaggle.jockeroika_car_showr
DataBase Carshowroom
@kaggle.jockeroika_car_showr
🚗 SQL Questions – Car Showroom Schema
1️⃣ Display the employee’s name + the name of the branch in which he works
2️⃣ Display all cars with the name of the manufacturer
3️⃣ Display all contracts with the employee’s name and the client’s name
4️⃣ Show all cars in each branch
5️⃣ Show the employees who have a supervisor
6️⃣ Display the contracts concluded in a specific branch
7️⃣ Show cars model after 2020
8️⃣ Show the employees who work in the same city as the branch
9️⃣ Show customers who have a second phone number
🔟 Show cars that have more than one color
1️⃣1️⃣ Show branches that have more than 5 employees
1️⃣2️⃣ Show companies that have more than 3 Arab models
1️⃣3️⃣ Show cars that have more than one contract.
1️⃣4️⃣ Show employees who have worked for more than two decades
1️⃣5️⃣ Show the branches in which the total number of cars is greater than 10
1️⃣6️⃣ Show employees whose salary is higher than the average salary
1️⃣7️⃣ Show cars whose price is higher than the average price of cars
1️⃣8️⃣ Show clients who have worked on contracts in more than one branch
1️⃣9️⃣ Show the employees who work in the same branch as their manager
2️⃣0️⃣ Only display cars with the latest price
2️⃣1️⃣ Show the employees whose number of contracts is greater than the average
2️⃣2️⃣ Show the branches whose income (sum car_price) is greater than the rest of the branches
2️⃣3️⃣ Show companies whose cars have been followed more than 5 times
2️⃣4️⃣ Show clients whose total contract money is higher than any other client
2️⃣5️⃣ Show the employees who worked on all types of cars
2️⃣6️⃣ Show the branch with the largest number of contracts
2️⃣7️⃣ Show the best-selling Arabic
2️⃣8️⃣ Show the top selling employee
2️⃣9️⃣ Show customers who have dealt with all payment methods
3️⃣0️⃣ Show the company whose average car prices are the highest
CREATE TABLE branch_data (
"branch_id" BIGINT,
"street" VARCHAR,
"city" VARCHAR,
"building_number" BIGINT,
"contact_number" BIGINT
);CREATE TABLE car_branch_data (
"car_id" BIGINT,
"branch_id" BIGINT,
"no_of_cars" BIGINT
);CREATE TABLE car_color_data (
"car_id" BIGINT,
"color_id" BIGINT
);CREATE TABLE car_data (
"car_id" BIGINT,
"company_id" BIGINT,
"model" VARCHAR,
"year" BIGINT
);CREATE TABLE car_price_history_data (
"car_price_id" BIGINT,
"car_id" BIGINT,
"price" DOUBLE,
"price_date" TIMESTAMP
);CREATE TABLE company_data (
"company_id" BIGINT,
"name" VARCHAR
);CREATE TABLE contract_data (
"contract_id" BIGINT,
"car_id" BIGINT,
"branch_id" BIGINT,
"emp_ssn" BIGINT,
"cust_ssn" BIGINT,
"method_id" BIGINT,
"car_price_id" BIGINT,
"contract_date" TIMESTAMP
);CREATE TABLE customer_data (
"ssn" BIGINT,
"fname" VARCHAR,
"lname" VARCHAR,
"street" VARCHAR,
"city" VARCHAR,
"building_number" BIGINT,
"phone_1" BIGINT,
"phone_2" BIGINT,
"gender" VARCHAR,
"birthdate" TIMESTAMP
);CREATE TABLE employee_data (
"ssn" BIGINT,
"fname" VARCHAR,
"lname" VARCHAR,
"street" VARCHAR,
"city" VARCHAR,
"building_number" BIGINT,
"phone_1" BIGINT,
"phone_2" BIGINT,
"gender" VARCHAR,
"birth_date" TIMESTAMP,
"job_id" BIGINT,
"supervisor_id" BIGINT,
"branch_id" BIGINT
);CREATE TABLE job_data (
"job_id" BIGINT,
"title" VARCHAR
);CREATE TABLE payment_method (
"method_id" BIGINT,
"method" VARCHAR
);CREATE TABLE salary_history (
"job_id" BIGINT,
"emp_ssn" BIGINT,
"salary" DOUBLE,
"comm_pct" DOUBLE,
"date" TIMESTAMP
);Anyone who has the link will be able to view this.