MaxxxxiorS

Zadania SQL 03.03.2021

Mar 3rd, 2021
614
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Zadanie 1.
  2. SELECT Employee.FirstName, Employee.LastName, Department.Name
  3. FROM Employee
  4. INNER JOIN Department ON Employee.DepartmentID = Department.ID;
  5.  
  6. Zadanie 2.
  7. SELECT Employee.FirstName, Employee.LastName, Department.Name
  8. FROM (Employee
  9. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  10. WHERE DepartmentID IS NULL;
  11.  
  12. Zadanie 3.
  13. SELECT Employee.FirstName, Employee.LastName
  14. FROM (Employee
  15. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  16. WHERE Department.Name = "IT";
  17.  
  18. Zadanie 4.
  19. SELECT Employee.FirstName, Employee.LastName, Employee.Salary, Department.Name
  20. FROM (Employee
  21. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  22. WHERE Department.Name = "__" AND Employee.Salary < 2000;
  23.  
  24. Zadanie 5.
  25. SELECT Employee.FirstName, Employee.LastName, Department.Name
  26. FROM (Employee
  27. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  28. ORDER BY Employee.Salary DESC LIMIT 1;
  29.  
  30. Zadanie 6.
  31. SELECT DISTINCT Department.Name
  32. FROM (Department
  33. INNER JOIN Employee ON Employee.DepartmentID = Department.ID);
  34. WHERE Employee.DepartmentID IS NOT NULL OR Employee.DepartmentID != 0;
  35.  
  36. Zadanie 7.
  37. SELECT Department.Name, Employee.FirstName, Employee.LastName
  38. FROM (Employee
  39. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  40. ORDER BY Department.Name ASC;
  41.  
  42. Zadanie 8.
  43. SELECT Department.Name, Employee.FirstName, Employee.LastName
  44. FROM Employee
  45. INNER JOIN Department ON Employee.ID = Department.ManagerID;
  46.  
  47. Zadanie 9.
  48. SELECT Department.Name, Employee.FirstName, Employee.LastName
  49. FROM Employee
  50. INNER JOIN Department ON Employee.ID = Department.ManagerID;
  51.  
  52. Zadanie 10.
  53. SELECT Department.Name
  54. FROM Department
  55. INNER JOIN Employee ON Employee.ID != Department.ManagerID;
  56.  
  57. Zadanie 11.
  58. SELECT Department.Name
  59. FROM Department
  60. INNER JOIN Employee ON Employee.DepartmentID != Department.ID;
  61.  
  62. Zadanie 12.
  63. SELECT Department.Name, City.Name
  64. FROM Department
  65. INNER JOIN City ON Department.CityID = City.ID;
  66.  
  67. Zadanie 13.
  68. SELECT Employee.FirstName, Employee.LastName, Department.Name, City.Name
  69. FROM ((Employee
  70. INNER JOIN Department ON Employee.DepartmentID = Department.ID)
  71. INNER JOIN City ON Department.CityID = City.ID);
  72.  
  73. Zadanie 14.
  74. SELECT Employee.FirstName, Employee.LastName, Department.Name, City.Name
  75. FROM ((Employee
  76. INNER JOIN Department ON Employee.DepartmentID = Department.ID)
  77. INNER JOIN City ON Department.CityID = City.ID);
  78. WHERE Employee.FirstName LIKE "J%" AND City.ID = "Warsaw";
  79.  
  80. Zadanie 15.
  81. SELECT Employee.FirstName, Employee.LastName
  82. FROM ((Employee
  83. INNER JOIN Department ON Employee.DepartmentID = Department.ID);
  84. INNER JOIN City ON Department.CityID = City.ID);
  85. WHERE LEFT(Employee.FirstName, 1) = LEFT(City.Name, 1);
  86.  
  87. Zadanie 16.
  88. SELECT Employee.FirstName, Employee.LastName
  89. FROM Employee
  90. INNER JOIN Department ON Employee.ID != Department.ManagerID;
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×