Skip to content

Instantly share code, notes, and snippets.

@yurijserrano
Created May 6, 2024 05:45
Show Gist options
  • Save yurijserrano/06845ffe8f92748cd92ac00156d88303 to your computer and use it in GitHub Desktop.
Save yurijserrano/06845ffe8f92748cd92ac00156d88303 to your computer and use it in GitHub Desktop.
Challenges - Second Exercise Solution
UPDATE vehicles SET registration_date = CURRENT_DATE - INTERVAL '11 months' WHERE id = 1;
UPDATE vehicles SET registration_date = CURRENT_DATE - INTERVAL '12 months' WHERE id = 2;
UPDATE vehicles SET registration_date = CURRENT_DATE - INTERVAL '18 months' WHERE id = 3;
UPDATE vehicles SET registration_date = CURRENT_DATE - INTERVAL '20 months' WHERE id = 4;
SELECT d.first_name, d.last_name, v.make, v.model, v.registration_date
FROM drivers d
JOIN vehicles v ON d.id = v.driver_id
WHERE v.registration_date = CURRENT_DATE - INTERVAL '11 months';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment