summaryrefslogtreecommitdiff
path: root/wk7/pset
diff options
context:
space:
mode:
Diffstat (limited to 'wk7/pset')
-rw-r--r--wk7/pset/fiftyville/answers.txt2
-rw-r--r--wk7/pset/fiftyville/log.sql70
2 files changed, 70 insertions, 2 deletions
diff --git a/wk7/pset/fiftyville/answers.txt b/wk7/pset/fiftyville/answers.txt
index 4096bd8..406256c 100644
--- a/wk7/pset/fiftyville/answers.txt
+++ b/wk7/pset/fiftyville/answers.txt
@@ -1,3 +1,3 @@
The THIEF is:
-The city the thief ESCAPED TO:
+The city the thief ESCAPED TO: New York City
The ACCOMPLICE is:
diff --git a/wk7/pset/fiftyville/log.sql b/wk7/pset/fiftyville/log.sql
index 894fb2c..8ff3a40 100644
--- a/wk7/pset/fiftyville/log.sql
+++ b/wk7/pset/fiftyville/log.sql
@@ -128,4 +128,72 @@ WHERE id = (
);
-- Destination City is New York City
--- Check passengers on flight with id of 36
+-- What data does passengers have?
+.schema passengers
+-- flight_id, passport_number, seat
+
+-- Check passport numbers and seats of passengers on flight with id of 36
+SELECT passport_number, seat
+FROM passengers
+WHERE flight_id = (SELECT destination_airport_id
+ FROM flights
+ WHERE year = 2023
+ AND month = 7
+ AND day = 29
+ AND origin_airport_id = (
+ SELECT id
+ FROM airports
+ WHERE city = "Fiftyville"
+ )
+ ORDER BY hour
+ LIMIT 1
+);
+-- | passport_number | seat |
+-- | 7214083635 | 2A |
+-- | 1695452385 | 3B |
+-- | 5773159633 | 4A |
+-- | 1540955065 | 5C |
+-- | 8294398571 | 6C |
+-- | 1988161715 | 6D |
+-- | 9878712108 | 7A |
+-- | 8496433585 | 7B |
+
+-- Check which person was on the flight (passport number), at the bakery (license plate), caller or receiver phone number,
+SELECT name
+FROM people
+WHERE phone_number IN (
+ SELECT caller, receiver
+ FROM phone_calls
+ WHERE year = 2023
+ AND month = 7
+ AND day = 28
+ AND duration <= 60
+) AND passport_number IN (
+ SELECT passport_number
+ FROM passengers
+ WHERE flight_id = (
+ SELECT destination_airport_id
+ FROM flights
+ WHERE year = 2023
+ AND month = 7
+ AND day = 29
+ AND origin_airport_id = (
+ SELECT id
+ FROM airports
+ WHERE city = "Fiftyville"
+ )
+ ORDER BY hour
+ LIMIT 1
+ )
+) AND license_plate IN (
+ SELECT license_plate
+ FROM bakery_security_logs
+ WHERE year = 2023
+ AND month = 7
+ AND day = 28
+ AND hour = 10
+ AND minute >= 05
+ AND minute <= 25
+ AND activity LIKE "exit"
+)
+;