Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created Jun 11, 2020
Embed
What would you like to do?
Give FirstNames of People from Minnesota with amount_due more than $100
WITH basic AS
(SELECT id,
first_name
FROM basic_details
WHERE lower(gender) = 'male' ), bill AS
(SELECT id
FROM bil_details
WHERE CAST(amount_due AS INTEGER) > 100 ), contact AS
(SELECT contact_details.id
FROM contact_details
JOIN bill
ON contact_details.id = bill.id
WHERE state= 'Minnesota' )
SELECT basic.first_name
FROM basic
JOIN contact
ON basic.id = contact.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment