rootCourseAssessments-DAG2-courseAssessments_Exercise 3 - SQL Funamentals (SQL CASE Statements)
rootCourseAssessments-DAG2-courseAssessments_Exercise 3 - SQL Funamentals (SQL CASE Statements)
SQL Fundamentals
Instructions:
Questions
1. Table: products
product_id product_name price
1 Laptop 1200.00
2 Phone 800.00
3 Keyboard 45.00
4 Monitor 300.00
5 Mouse 25.00
Question:
● product_name
● price
● price_category
2. Table: orders
order_id customer_name amount
1 Alice 150.00
2 Bob 560.00
3 Charlie 999.99
4 Diana 45.50
5 Ethan 1200.00
Question:
● customer_name
● amount
● order_value_category
3. Table: employees
emp_id emp_name department salary
1 John IT 85000
2 Sara HR 60000
3 Mark IT 75000
5 Tom HR 55000
Question:
● emp_name
● department
● salary
● position_level
4. Table: students
student_i student_name score
d
1 Anna 92
2 Ben 76
3 Cara 59
4 David 83
5 Ella 68
Question:
● ≥ 90: 'A'
● 80–89: 'B'
● 70–79: 'C'
● 60–69: 'D'
● < 60: 'F'
● student_name
● score
● grade
5. Table: deliveries
delivery_id delivery_time_minutes
1 45
2 80
3 30
4 65
5 100
Question:
● ≤ 30 mins: 'Fast'
● 31–60 mins: 'On Time'
● 60 mins: 'Late'
● delivery_id
● delivery_time_minutes
● performance
6. Table: tickets
ticket_id issue_type priority
1 Login issue 1
2 Server down 3
3 Slow system 2
4 Email error 2
5 Password 1
reset
Question:
● 3 → 'High'
● 2 → 'Medium'
● 1 → 'Low'
● issue_type
● priority
● priority_label
7. Table: attendance
student_i days_presen total_day
d t s
1 45 50
2 30 50
3 48 50
4 25 50
5 50 50
Question:
● ≥ 90% → 'Excellent'
● 75–89% → 'Good'
● < 75% → 'Needs Improvement'
● student_id
● attendance_percentage
● attendance_status
8. Table: products_inventory
product_id stock_qty
1 5
2 0
3 25
4 10
5 3
Question:
● 0 → 'Out of Stock'
● 1–5 → 'Low Stock'
● 5 → 'In Stock'
● product_id
● stock_qty
● stock_status
9. Table: classes
class_id subject enrolled_students
1 Math 30
2 English 25
3 Science 15
4 Art 5
5 History 20
Question:
Classify by size:
● ≥ 25 → 'Large'
● 10–24 → 'Medium'
● < 10 → 'Small'
● subject
● enrolled_students
● class_size_category
10. Table: payments
payment_id amount payment_method
1 50.00 Card
2 200.00 Cash
3 150.00 Card
4 75.00 PayPal
5 300.00 Cash
Question:
● payment_id
● payment_method
● amount
● discount_eligibility