Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion SQL Deep Dive/Comparison Operators/questions.sql
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
-- How many female customers do we have from the state of Oregon (OR)?
/*
* Write your query here
SELECT count( * ) FROM customers
WHERE state='OR' AND gender='F'

*/

-- Who over the age of 44 has an income of 100 000 or more? (excluding 44)
/*
* Write your query here
SELECT firstname ,lastname, age,income FROM customers
WHERE age > 44 AND income >= 100000
*/

-- Who between the ages of 30 and 50 has an income less than 50 000?
-- (include 30 and 50 in the results)

/*
* Write your query here
SELECT firstname ,lastname, age,income FROM customers
WHERE (age >= 30 AND age <= 50 AND income <= 50000)

*/

-- What is the average income between the ages of 20 and 50? (Excluding 20 and 50)
/*
* Write your query here
SELECT avg(income) FROM customers
WHERE (age > 20 AND age < 50)

*/