cds-104/murder_mystery/querys.sql
git-sandro 522e144ca3 sql
2026-02-13 15:27:24 +01:00

22 lines
1.3 KiB
SQL

SELECT * FROM crime_scene_report WHERE city = 'SQL City' AND date = 20180115 AND type = 'murder';
-- Security footage shows that there were 2 witnesses. The first witness lives at the last house on "Northwestern Dr".
-- The second witness, named Annabel, lives somewhere on "Franklin Ave".
-- first witness
SELECT * FROM person WHERE address_street_name = 'Northwestern Dr' ORDER BY address_number DESC LIMIT 1;
-- id 14887 name Morty Schapiro license_id 118009 ssn 111564949
SELECT transcript FROM interview WHERE person_id = 14887;
-- I heard a gunshot and then saw a man run out. He had a "Get Fit Now Gym" bag. The membership number on the bag started with "48Z".
-- Only gold members have those bags. The man got into a car with a plate that included "H42W".
SELECT * FROM get_fit_now_member WHERE id LIKE '48Z%' AND membership_status = 'gold';
SELECT * FROM drivers_license WHERE plate_number LIKE '%H42W%';
-- second witness
SELECT * FROM person WHERE name LIKE '%Annabel%' AND address_street_name = 'Franklin Ave';
-- id 16371 name Annabel Miller license_id 490173 ssn 318771143
SELECT transcript FROM interview WHERE person_id = 16371;
-- I saw the murder happen, and I recognized the killer from my gym when I was working out last week on January the 9th.
SELECT * FROM get_fit_now_check_in WHERE check_in_date = 20180109 AND membership_id LIKE '48Z%'