Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Enrollment (1).pdf
Binary file not shown.
Binary file added Sailors (1).pdf
Binary file not shown.
Binary file added company (1).pdf
Binary file not shown.
10 changes: 6 additions & 4 deletions insurance.sql
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ INSERT INTO participated VALUES


-- Find the total number of people who owned a car that were involved in accidents in 2021

select COUNT(driver_id)
from participated p, accident a
where p.report_no=a.report_no and a.accident_date like "2021%";
SELECT COUNT(DISTINCT P.driver_id) AS total_owners
FROM person P
JOIN owns O ON P.driver_id = O.driver_id
JOIN participated PA ON O.driver_id = PA.driver_id AND O.reg_no = PA.reg_no
JOIN accident A ON PA.report_no = A.report_no
WHERE YEAR(A.accident_date) = 2021;

-- Find the number of accident in which cars belonging to smith were involved

Expand Down
Binary file added insurence (1).pdf
Binary file not shown.
Binary file added orders (1).pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion sailors.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ select * from Boat;
select * from reserves;

-- Find the colours of the boats reserved by Albert
select color
SELECT DISTINCT b.color
from Sailors s, Boat b, reserves r
where s.sid=r.sid and b.bid=r.bid and s.sname="Albert";

Expand Down