commit f1ecfafbadbe40e60c4c4598131faa270be1cd8b Author: bot50 Date: Tue Apr 21 07:50:29 2026 +0000 daviddoji-cs50/problems/2024/sql/packages@20260421T075029.296443778Z diff --git a/answers.txt b/answers.txt new file mode 100644 index 0000000..1e894cc --- /dev/null +++ b/answers.txt @@ -0,0 +1,9 @@ + +At what type of address did the Lost Letter end up?: Residential +At what address did the Lost Letter end up?: 2 Finnigan Street + +At what type of address did the Devious Delivery end up?: Police station +What were the contents of the Devious Delivery?: Duck debugger + +What are the contents of the Forgotten Gift?: Flowers +Who has the Forgotten Gift?: Mikel diff --git a/log.sql b/log.sql new file mode 100644 index 0000000..5f6053e --- /dev/null +++ b/log.sql @@ -0,0 +1,43 @@ + +-- *** The Lost Letter *** +-- Get the address id of sender ==> id 432, type Residential +SELECT * FROM "addresses" WHERE "address" = "900 Somerville Avenue"; + +-- Get the address id of receiver ==> id 854, type Residential +SELECT * FROM "addresses" WHERE "address" LIKE "2 Fin%Street"; + +-- Get the id and contents from the parcel send by sender to receiver +SELECT * FROM "packages" WHERE "from_address_id" = 432 AND "to_address_id" = 854; + + + +-- *** The Devious Delivery *** +-- Get the delivery address of the parcel with missing "from_address_id" +SELECT * FROM "packages" WHERE "from_address_id" IS NULL; + +-- Get info about the package +SELECT * FROM "scans" WHERE "package_id" = 5098; + +-- Get info about where the parcel ended up +SELECT * FROM "addresses" WHERE "id" = 348; + + + +-- *** The Forgotten Gift *** +-- Get the address id of sender ==> id 4983, type Residential +SELECT * FROM "addresses" WHERE "address" = "728 Maple Place"; + +-- Get package id and content ==> id 9523, contents Flowers +SELECT * FROM "packages" WHERE "to_address_id" = 4983; + +-- Confirm address of sender ==> 109 Tileston Street +SELECT * FROM "addresses" WHERE "id" = 9873; + +-- Who has the parcel +SELECT * FROM "scans" WHERE "package_id" = 9523; + +-- Get the address of who pick up the parcel ==> a warehouse in 950 Brannon Harris Way +SELECT * FROM "addresses" WHERE "id" = 7432; + +-- Get name of driver who pick up the parcel +SELECT * FROM "drivers" WHERE "id" = 17;