From 671717a74e5fb8988507470c95cb607135cc08f7 Mon Sep 17 00:00:00 2001 From: Aarif Hannan <69072800+hannanaarif@users.noreply.github.com> Date: Wed, 5 Mar 2025 00:28:41 +0530 Subject: [PATCH] Update questions.sql --- SQL Deep Dive/Comparison Operators/questions.sql | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/SQL Deep Dive/Comparison Operators/questions.sql b/SQL Deep Dive/Comparison Operators/questions.sql index 750602d..bfff1a2 100644 --- a/SQL Deep Dive/Comparison Operators/questions.sql +++ b/SQL Deep Dive/Comparison Operators/questions.sql @@ -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) + */