Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Database Schema: Classes(class, type, country, numGuns, bore, displacement) Ship

ID: 669224 • Letter: D

Question

Database Schema:

Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)
Battles(name, date)
Outcomes(ship, battle, result)

Based on Exercise 6.1.4 (page 257-258). 1 pt. per query 1. Find the class name and country for all classes with more than 5 guns 2. Find the names of all the ships launched prior to 1930, but call the resulting column ship 3. Find the names of ships damaged in battle and the name of the battle in which they were damaged. 4. Find all ships that have a different name from their class 5. Find the names of all ships that end with the letter A. 6. Find the names of all ships whose name consists of two or more words (e.g., King George V)

Explanation / Answer

1) select class , country from Classes where numGuns > 5;

2) select name from Ships where launched < 1930;

3) select ship ,battle from Outcomes where result = 'damaged';

4) select name from Outcomes where name < > class;

5) select name from Ships where name Like '%A'

6) select name FROM Ships WHERE name REGEXP '^[^ ]+[ ]+[^ ]+$'