deyanmalinov

08-mysql

Jun 13th, 2021
759
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select * from departments;
  2.  
  3. select name from departments
  4. order by department_id;
  5.  
  6. select first_name, last_name, salary
  7. from employees;
  8.  
  9. select first_name, middle_name, last_name
  10. from employees;
  11.  
  12. select concat(first_name, '.', last_name, '@softuni.bg')
  13. from employees;
  14.  
  15. select distinct salary
  16. from employees;
  17.  
  18. select * from employees where job_title = 'Sales Representative' ;
  19.  
  20. select first_name, last_name, job_title
  21. from employees
  22. where salary between 20000 and 30000;
  23.  
  24. select concat_ws(' ', first_name, middle_name, last_name) as 'Full Name'
  25. from employees
  26. where salary in (14000, 12500, 25000, 23600);
  27.  
  28. select first_name, last_name
  29. from employees
  30. where manager_id is null;
  31.  
  32. select first_name, last_name, salary
  33. from employees
  34. where salary > 50000 order by salary desc;
  35.  
  36. select first_name, last_name
  37. from employees
  38. order by salary desc limit 5;
  39.  
  40. select first_name, last_name
  41. from employees
  42. where department_id != 4;
  43.  
  44. select * from employees
  45. order by salary desc, first_name, last_name desc, middle_name;
  46.  
  47. create view v_employees_salaries as
  48. select first_name, last_name, salary
  49. from employees;
  50. select * from v_employees_salaries;
  51.  
  52. create view v_employees_job_titles as
  53. select concat_ws(' ', first_name, middle_name, last_name)
  54. as 'full_name', job_title
  55. from employees;
  56. select * from v_employees_job_titles;
  57.  
  58. select distinct job_title from employees;
  59.  
  60. select name, start_date from projects
  61. order by start_date, name
  62. limit 10;
  63.  
  64. select first_name, last_name, hire_date
  65. from employees
  66. order by hire_date desc
  67. limit 7;
  68.  
  69. update employees
  70. set salary=salary*1.12;
  71. select salary from employees;
  72.  
  73. select peak_name from peaks
  74. order by peak_name;
  75.  
  76. select country_name, population F
  77. ROM countries
  78. where continent_code = 'EU'
  79. order by population desc, country_name
  80. limit 30;
  81.  
  82. SELECT country_name, country_code,
  83. if(currency_code = 'EUR', 'Euro', 'Not Euro') as 'currency'
  84. FROM countries
  85. order by country_name;
  86.  
  87. select name from characters
  88. order by name;
  89.  
  90.  
  91.  
  92.  
  93.  
RAW Paste Data