Advertisement
desislava_topuzakova

Untitled

Jun 16th, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. Basic CRUD - Exercise
  2. # 1. Find All Information About Departments
  3. SELECT * FROM `departments`
  4. ORDER BY `department_id`;
  5.  
  6. # 2. Find all Department Names
  7. SELECT `name` FROM `departments`
  8. ORDER BY `department_id`;
  9.  
  10. # 3. Find salary of Each Employee
  11. SELECT `first_name`, `last_name`, `salary` FROM `employees`
  12. ORDER BY `employee_id`;
  13.  
  14. # 4. Find Full Name of Each Employee
  15. SELECT `first_name`, `middle_name`, `last_name` FROM `employees`
  16. ORDER BY `employee_id`;
  17.  
  18. # 5. Find Email Address of Each Employee
  19. # email: {first name}.{last name}@softuni.bg
  20. SELECT CONCAT(`first_name`, '.', `last_name`, '@softuni.bg')
  21. AS `full_email_address`
  22. FROM `employees`;
  23.  
  24. # 6. Find All Different Employee's Salaries
  25. SELECT DISTINCT `salary` FROM `employees`;
  26.  
  27. # 7. Find all Information About Employees
  28. SELECT * FROM `employees`
  29. WHERE `job_title` = "Sales Representative"
  30. ORDER BY `employee_id`;
  31.  
  32. # 8. Find Names of All Employees by salary in Range
  33. SELECT `first_name`, `last_name`, `job_title` FROM `employees`
  34. WHERE `salary` BETWEEN 20000 AND 30000
  35. ORDER BY `employee_id`;
  36.  
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement