Solution:-
Createa a Database in 3NF & write queries for following.
• Display details of all persons who are driving ‘Alto’ car.
SQL>Select dname from person,car,pc where perrson.did=pc.did and car.lno and model='alto';
• Count the number of cars driven by each driver.
SQL>Select count(model),dname from person,car,pc where person.did=pc.did and car.lno=pc.lno group by dname;
• Display car details manufactured before year 2000.
SQL>Select * from car where year<2000;
• In which day ‘Mr. Ram’ drives maximum number of cars.
SQL>select count(car.model),dates,dname from person,car,pc where person.did=pc.did and car.lno=pc.lno and dname='ram' group by dates,dname;
• Display total number of persons who drives car in each year.
SQL>select count(person.did),year,dname from person,car,pc where person.did=pc.did and car.lno group by year,dname;
/