Question
write the sql queries for : 1- the years when more than 10 cars where sold 2- the car models sold more than 10 cars
write the sql queries for :
1- the years when more than 10 cars where sold
2- the car models sold more than 10 cars in one year
3- the customers registered or not with their license number and loyalty points
4- the rented cars that will be returned before end of march
table structure:
create table car(car_id int,brand varchar(10),model varchar(10),color varchar(10),rental_category varchar(10),selling_price int , primary key( car_id));
create table customer(customer_id int,name varchar(15),date_of_birth date ,primary key(customer_id ));
create table registered(customer_id int,liscense_number int,loyalty_points int, primary key(customer_id ) ,foreign key(customer_id) references customer(customer_id));
create table registered_tel(customer_id int,name number int, primary key(customer_id,number) ,foreign key(customer_id) references customer(customer_id));
create table buy(customer_id int,car_id int,date date,cc_number int,cc_expiry_date date,cc_security_code int , primary key(customer_id,car_id,date ), foreign key(customer_id) references customer(customer_id) ,foreign key(car_id) references car(car_id));
create table rent(customer_id int,car_id int,rental_date date,retur_date date , primary key( customer_id,car_id,rental_date) ,foreign key(customer_id) references customer(customer_id),foreign key(car_id) references car(car_id));
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started