SQL Query Help Needed.?

NoahRyan

New member
Local time
Today, 10:32
Joined
Mar 28, 2011
Messages
2
The following question has got me stumped and i really need help in trying to figure it out.

Write a SQL querie based on the following database schema about battleships:
Classes (class, type, country, numGuns, bore, displacement)
Ships (name, class, launched)
Battles (name, date)
Outcomes (ship, battle, result)

Q. Find the number of ships launched for only those classes which
had at least one ship in a battle before 1940
 
Q. Find the number of ships launched for only those classes which
had at least one ship in a battle before 1940

Did you normalised your tables properly i.e the relationships between the tables has the PK and FK?

What Query u are using to get the result so far?

Your Query should be somthing like this:

Code:
SELECT COUNT(*) FROM ships INNER JOIN classes on ship.id=class.shipID
INNER JOIN battle ON ship.id = battle.id
WHERE battles.Date > #1-1-1941#;
 
Thank you very much! Helps me a lot.
 

Users who are viewing this thread

Back
Top Bottom