SHARE
TWEET

Random

a guest Dec 10th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1.
  2. Select "name", "surname", "telephone_number" from "Employee"
  3. join "Employee_Numbers" on "ssn" = "employee_id";
  4.  
  5. 2.
  6. Select "name", "surname", "telephone_number" from "Employee"
  7. join "Employee_Numbers" on "ssn" = "employee_id"
  8. where "telephone_number" like '071%' OR "telephone_number" like '070%' OR "telephone_number" like '072%';
  9.  
  10. 2.1
  11. select e.*
  12. from employee e
  13. where e.e# IN
  14.     (select en.n_e#
  15.      from employee_numbers en
  16.      where en.phone_number LIKE '070%' OR en.phone_number LIKE '071%' OR en.phone_number LIKE '072%')
  17.  
  18.  
  19. 3.
  20. Select "name", "surname" from "Employee"
  21. join "Seller" on "Seller"."ssn" = "Employee"."ssn"
  22. where "Employee"."ssn" not in (
  23.     Select "employee_id" as "ssn" from "Employee_Numbers" where REGEXP_LIKE ("telephone_number", '07[56789].*')
  24. );
  25.  
  26. 3.1
  27. select e.*
  28. from employee e
  29. where e.e# NOT IN
  30.     (select en.n_e#
  31.      from employee_numbers en
  32.      where en.phone_number LIKE '075%' OR en.phone_number LIKE '076%' OR en.phone_number LIKE '077%'
  33.     OR en.phone_number LIKE '078%')
  34.     AND e.e# IN
  35.     (select seller#
  36.     from seller)
  37.  
  38.  
  39. 4.
  40. Select "Agent_Seller"."ssn" from "Agent_Seller"
  41. join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn";
  42.  
  43. 4.1.
  44. SELECT a.a#
  45. FROM agent a
  46. WHERE a.a# IN
  47.     (SELECT a_seller#
  48.     from agent_seller)
  49.     AND a.a# IN
  50.     (SELECT a_manager#
  51.     from agent_manager)
  52.  
  53.  
  54. 5.
  55. Select "ssn" from "Agent_Seller"
  56. where "Agent_Seller"."ssn" not in
  57. (
  58.     Select "Agent_Seller"."ssn" from "Agent_Seller"
  59.     join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn"
  60. )
  61. UNION
  62. Select "ssn" from "Agent_Manager"
  63. where "Agent_Manager"."ssn" not in
  64. (
  65.     Select "Agent_Seller"."ssn" from "Agent_Seller"
  66.     join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn"
  67. );
  68.  
  69. 5.1
  70. SELECT e.e#
  71. FROM employee e
  72. WHERE e.e# IN
  73.     (SELECT a_seller#
  74.     from agent_seller)
  75.     OR e.e# IN
  76.     (SELECT a_manager#
  77.     from agent_manager)
  78.  
  79.  
  80.  
  81. 6.
  82. Select "Customer"."ssn", "Customer"."name", "Customer"."surname", "Employee"."ssn" as essn, "Employee"."name" as ename, "Employee"."surname" as esurname from "Customer"
  83. join "Employee" on "Customer"."assigned_agent_ssn" = "Employee"."ssn"
  84.  where "Customer"."ssn" like '7%';
  85.  
  86. 7.
  87. Select "comment" from "Product_Review"
  88. where "grade" > 2 and "comment" is not null;
  89.  
  90. 8.
  91. Select "comment" from "Store_Review"
  92. where "grade" > 2 and "comment" is not null;
  93.  
  94. 9.
  95. Select count(*) as "count" from "Scheduled_Talks" where "duration" > 30 and "agent_seller_ssn" like '1%';
  96.  
  97. 10.
  98. Select count(*) as "count" from "Agent_Seller"
  99. join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn";
  100.  
  101. 10.1
  102. select count(*)
  103. from employee e
  104. where e.e# IN
  105.     (SELECT a_seller#
  106.     FROM agent_seller)
  107.     AND e.e# IN
  108.     (SELECT a_manager#
  109.     FROM agent_manager)
  110.  
  111. 11.
  112. Select count(*) as "count" from (
  113.     Select "ssn" from "Agent_Seller"
  114.     where "Agent_Seller"."ssn" not in
  115.     (
  116.         Select "Agent_Seller"."ssn" from "Agent_Seller"
  117.         join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn"
  118.     )
  119.  
  120.     UNION
  121.  
  122.     Select "ssn" from "Agent_Manager"
  123.     where "Agent_Manager"."ssn" not in
  124.     (
  125.         Select "Agent_Seller"."ssn" from "Agent_Seller"
  126.         join "Agent_Manager" on "Agent_Manager"."ssn" = "Agent_Seller"."ssn"
  127.     )
  128. );
  129.  
  130. 11.1
  131. select count(*)
  132. from employee e
  133. where e.e# IN
  134.     (SELECT a_seller#
  135.     FROM agent_seller)
  136.     OR e.e# IN
  137.     (SELECT a_manager#
  138.     FROM agent_manager)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top