This project is a collection of SQL queries solving 50 exercises based on:
- String Functions
- Numeric Functions
- Date/Time Functions
- Conditional Logic
The exercises use a case study with the following tables:
employeesdepartmentsprojectsemployee_projects
The goal is to practice and demonstrate SQL functions in a real-world employee-project scenario.
database_work.sql
Contains all 50 SQL queries organized by category. Each query is numbered according to the question.
- Examples: concatenation, lowercase, substring, email modification, formatting.
- Examples: rounding, modulus, salary difference, power function, salary categorization.
- Examples: current date, hire duration, extract parts of date, ongoing project check.
- Examples: CASE statements for categorization, COALESCE usage, seniority, increment bands.
-- 1. Concatenate first and last name
SELECT CONCAT(first_name, ' ', last_name) AS full_name FROM employees;
-- 18. Calculate project duration in days
SELECT project_id, end_date - start_date AS duration_days FROM projects;
-- 36. Label salaries
SELECT employee_id, salary,
CASE
WHEN salary >= 7000 THEN 'High'
WHEN salary >= 4000 THEN 'Medium'
ELSE 'Low'
END AS salary_label
FROM employees;