You are on page 1of 3

id | name | phone_number | passport_number | license_plate

221103 | Patrick | (725) 555-4692 | 2963008352 | 5P2BI95

flight_id | passport_number | seat


2 | 2963008352 | 6C
20 | 2963008352 | 6B
39 | 2963008352 | 8C

sqlite> SELECT * from flights WHERE id=2;


id | origin_airport_id | destination_airport_id | year | month | day | hour |
minute
2 | 2 | 8 | 2020 | 7 | 30 | 12 | 44
sqlite> SELECT * from flights WHERE id=20;
id | origin_airport_id | destination_airport_id | year | month | day | hour |
minute
20 | 6 | 8 | 2020 | 7 | 28 | 15 | 22
sqlite> SELECT * from flights WHERE id=39;
id | origin_airport_id | destination_airport_id | year | month | day | hour |
minute
39 | 5 | 8 | 2020 | 7 | 27 | 22 | 37

id | abbreviation | full_name | city


6 | BOS | Logan International Airport | Boston
8 | CSF | Fiftyville Regional Airport | Fiftyville

sqlite> SELECT * FROM flights WHERE origin_airport_id=8 and month=7 and day=28;
id | origin_airport_id | destination_airport_id | year | month | day | hour |
minute
1 | 8 | 7 | 2020 | 7 | 28 | 17 | 50
6 | 8 | 5 | 2020 | 7 | 28 | 13 | 49
17 | 8 | 4 | 2020 | 7 | 28 | 20 | 16
34 | 8 | 5 | 2020 | 7 | 28 | 17 | 20
35 | 8 | 4 | 2020 | 7 | 28 | 16 | 16

------------
SELECT description FROM crime_scene_reports WHERE month=7 AND day=28 AND
street="Chamberlin Street";

description
Theft of the CS50 duck took place at 10:15am at the Chamberlin Street courthouse.
Interviews were conducted today with three witnesses who were present at the time —
each of their interview transcripts mentions the courthouse.

SELECT * FROM interviews WHERE month=7 AND day=28;

161 | Ruth | 2020 | 7 | 28 | Sometime within ten minutes of the theft, I saw the
thief get into a car in the courthouse parking lot and drive away. If you have
security footage from the courthouse parking lot, you might want to look for cars
that left the parking lot in that time frame.
162 | Eugene | 2020 | 7 | 28 | I don't know the thief's name, but it was someone I
recognized. Earlier this morning, before I arrived at the courthouse, I was walking
by the ATM on Fifer Street and saw the thief there withdrawing some money.
163 | Raymond | 2020 | 7 | 28 | As the thief was leaving the courthouse, they
called someone who talked to them for less than a minute. In the call, I heard the
thief say that they were planning to take the earliest flight out of Fiftyville
tomorrow. The thief then asked the person on the other end of the phone to purchase
the flight ticket.

1)
sqlite> SELECT id FROM people WHERE license_plate IN (SELECT license_plate FROM
courthouse_security_logs WHERE month=7 AND day=28 AND hour=10 AND license_plate IN
(SELECT license_plate FROM people WHERE id IN (SELECT person_id FROM bank_accounts
WHERE account_number IN (SELECT account_number FROM atm_transactions WHERE month=7
AND day=28 AND atm_location="Fifer Street"))));

id
396669
449774
467400
514354
686048

Y...

SELECT id FROM people WHERE phone_number IN (SELECT caller FROM phone_calls WHERE
month=7 AND day=28 AND duration<60);

id
395717
398010
438727
449774
514354
560886
686048
907148

SELECT id FROM people WHERE license_plate IN (SELECT license_plate FROM


courthouse_security_logs WHERE month=7 AND day=28 AND hour=10 AND license_plate IN
(SELECT license_plate FROM people WHERE id IN (SELECT person_id FROM bank_accounts
WHERE account_number IN (SELECT account_number FROM atm_transactions WHERE month=7
AND day=28 AND atm_location="Fifer Street")))) AND phone_number IN (SELECT caller
FROM phone_calls WHERE month=7 AND day=28 AND duration<60);

id
449774
514354
686048

SELECT id FROM people WHERE passport_number IN (SELECT passport_number FROM


passengers WHERE flight_id IN (SELECT id FROM flights WHERE month=7 AND day=28 AND
origin_airport_id IN (SELECT id FROM airports WHERE full_name LIKE "%Fiftyville%")
ORDER BY hour DESC LIMIT 1));

id
341739
423393
505688
632023
745650
750165
780088
872102

514354 Russell (770) 555-1861 3592750733 322W7JE


686048 Ernest (367) 555-5533 5773159633 94KL13X

You might also like