ExcelStore

Расширенные возможности SQL. Команды SQL в рамках урока #9

Apr 8th, 2021 (edited)
363
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Расширенные возможности SQL
  2. --Команды SQL в рамках урока #9
  3.  
  4.  
  5. SELECT * FROM EMP_DETAILS_VIEW;
  6.  
  7.  
  8. SELECT * FROM EMPLOYEES;
  9.  
  10.  
  11. CREATE VIEW KMV_EMPLOYEE AS
  12. SELECT a.EMPLOYEE_ID, a.FIRST_NAME, a.LAST_NAME, b.DEPARTMENT_NAME, a.SALARY
  13. FROM
  14.    EMPLOYEES a
  15.    LEFT JOIN DEPARTMENTS b ON a.DEPARTMENT_ID = b.DEPARTMENT_ID
  16. WHERE
  17.    a.EMPLOYEE_ID >= 150
  18.    AND b.DEPARTMENT_NAME IS NOT NULL
  19.    AND b.DEPARTMENT_NAME NOT IN ('Shipping', 'Sales')
  20. ;
  21.  
  22.  
  23. CREATE OR REPLACE VIEW KMV_EMPLOYEE AS
  24. SELECT a.EMPLOYEE_ID, a.FIRST_NAME, a.LAST_NAME, b.DEPARTMENT_NAME, a.SALARY
  25. FROM
  26.    EMPLOYEES a
  27.    LEFT JOIN DEPARTMENTS b ON a.DEPARTMENT_ID = b.DEPARTMENT_ID
  28. WHERE
  29.    a.EMPLOYEE_ID >= 150
  30.    AND b.DEPARTMENT_NAME IS NOT NULL
  31.    AND b.DEPARTMENT_NAME NOT IN ('Shipping', 'Sales')
  32.    AND SALARY > 8000
  33. ;
  34.  
  35.  
  36. SELECT * FROM KMV_EMPLOYEE;
  37.  
  38.  
  39. SELECT * FROM KMV_EMPLOYEE
  40. WHERE EMPLOYEE_ID = 204
  41. ;
  42.  
  43.  
  44. DROP VIEW KMV_EMPLOYEE;
  45.  
  46.  
RAW Paste Data