Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use the tables in your schema. Display the employee last name and employee id along with their manager's last name and manager number (in other
Use the tables in your schema. Display the employee last name and employee id along with their manager's last name and manager number (in other words the manager's employee id) for all employees whose last name begins with 'T'. Label the columns Employee, Emp#, Manager, and Mgr#, respectively (note the use of upper and lower case). Sort the results by employee last name in descending sequence. Write the query in SQL/86 and SQL/92.
-- 4A -- SQL/86
-- 4B -- SQL/92
manager name is employee name
ICS 120X01_W21.JOBS P. JOB_ID VARCHAR2(10 BYTE) JOB_TITLE VARCHAR2 (35 BYTE) MIN_SALARY NUMBER (0) MAX_SALARY NUMBER (6) JOB_ID_PK (JOD_ID) JOB_ID_PK (JOB_ID) JOB_ID ICS120XD1 W21.EMPLOYEES P. EMPLOYEE_ID NUMBER (6) FIRST_NAME VARCHAR2 (20 BYTE) LAST_NAME VARCHAR2 (25 BYTE) U EMAIL VARCHAR2 (25 BYTE) PHONE_NUMBER VARCHAR2 (20 BYTE) HIRE_DATE DATE VARCHAR2(10 BYTE) SALARY NUMBER (82) COMMISSION_PCT NUMBER (22) MANAGER_ID NUMBER (6) DEPARTMENT ID NUMBER (4) EMP_EMAIL_UK (EMAIL) EMP_EMP_ID_PK (EMPLOYEE_ID) EMP_DEPT_FK (DEPARTMENT_ID) EMP_JOB_FK (JOB_ID) EMP_MANAGER_FK (MANAGER_ID) EMP_DEPARTMENT_IX (DEPARTMENT_ID) EMP_EMAIL_UK (EMAIL) EMP_EMP_ID_PK (EMPLOYEE_ID) EMP_JOB_IX (JOB_ID) EMP_MANAGER_IX (MANADER_ID) EMP_NAME_IX (LAST_NAME, FIRST_NAME) Column Names ICS120X01_W21.JOB_HISTORY KPF EMPLOYEE_ID NUMBER (0) PSTART_DATE DATE * END_DATE DATE FJOB_ID VARCHAR2(10 BYTE) F DEPARTMENT_ID NUMBER (4) JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID, START_DATE) JHIST_DEPT_FK (DEPARTMENT_ID) JHIST_EMP_FK (EMPLOYEE_ID) JHIST_JOB_FK (OB_ID) JHIST_DEPARTMENT_IX (DEPARTMENT_ID) JHIST_EMPLOYEE_IX (EMPLOYEE_ID) JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID. START_DATE) JHIST JOB_IX (JOB_ID) Primary key Constraint Name Foreign Key Constraint Names ICS120 X01_W21. DEPARTMENTS P. DEPARTMENT ID NUMBER (4) DEPARTMENT_NAME VARCHAR2 (30 BYTE) F MANAGER_ID NUMBER (0) F LOCATION_ID NUMBER (4) DEPT_ID_PK (DEPARTMENT_ID) DEPT_LOC_FK (LOCATION_ID) DEPT_MGR_FK (MANAGER_ID) DEPT_ID_PK (DEPARTMENT_ID) DEPT_LOCATION_IX (LOCATION_ID) Index Names OM - CITY ICS120X01_W21. LOCATIONS P LOCATION_ID NUMBER (4) STREET_ADDRESS VARCHAR2 (40 BYTE) POSTAL_CODE VARCHAR2(12 BYTE) VARCHAR2 (30 BYTE) STATE_PROVINCE VARCHAR2 (25 BYTE) F COUNTRY_ID CHAR 2 BYTE) >> LOC_ID_PK (LOCATION_ID) LOC_C_ID_FK (COUNTRY_ID) LOC_CITY_UX (CITY) LOC_COUNTRY_IX (COUNTRY_ID) LOC_ID_PK (LOCATION_ID) LOC_STATE_PROVINCE_IX (STATE_PROVINCE) ICS 120X01_W21.COUNTRIES P. COUNTRY_ID CHAR 2 BYTE) COUNTRY_NAME VARCHAR2 (40 BYTE) REGION_ID NUMBER COUNTRY_C_ID_PK (COUNTRY_ID) COUNTR_REO_FK (REGION_ID) ICS120X01_W21 REGIONS P. REGION_ID NUMBER REGION NAME VARCHAR2 (26 BYTE) REG_ID_PK (REGION_ID) REG_ID_PK (REGION_ID) ICS 120X01_W21.JOBS P. JOB_ID VARCHAR2(10 BYTE) JOB_TITLE VARCHAR2 (35 BYTE) MIN_SALARY NUMBER (0) MAX_SALARY NUMBER (6) JOB_ID_PK (JOD_ID) JOB_ID_PK (JOB_ID) JOB_ID ICS120XD1 W21.EMPLOYEES P. EMPLOYEE_ID NUMBER (6) FIRST_NAME VARCHAR2 (20 BYTE) LAST_NAME VARCHAR2 (25 BYTE) U EMAIL VARCHAR2 (25 BYTE) PHONE_NUMBER VARCHAR2 (20 BYTE) HIRE_DATE DATE VARCHAR2(10 BYTE) SALARY NUMBER (82) COMMISSION_PCT NUMBER (22) MANAGER_ID NUMBER (6) DEPARTMENT ID NUMBER (4) EMP_EMAIL_UK (EMAIL) EMP_EMP_ID_PK (EMPLOYEE_ID) EMP_DEPT_FK (DEPARTMENT_ID) EMP_JOB_FK (JOB_ID) EMP_MANAGER_FK (MANAGER_ID) EMP_DEPARTMENT_IX (DEPARTMENT_ID) EMP_EMAIL_UK (EMAIL) EMP_EMP_ID_PK (EMPLOYEE_ID) EMP_JOB_IX (JOB_ID) EMP_MANAGER_IX (MANADER_ID) EMP_NAME_IX (LAST_NAME, FIRST_NAME) Column Names ICS120X01_W21.JOB_HISTORY KPF EMPLOYEE_ID NUMBER (0) PSTART_DATE DATE * END_DATE DATE FJOB_ID VARCHAR2(10 BYTE) F DEPARTMENT_ID NUMBER (4) JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID, START_DATE) JHIST_DEPT_FK (DEPARTMENT_ID) JHIST_EMP_FK (EMPLOYEE_ID) JHIST_JOB_FK (OB_ID) JHIST_DEPARTMENT_IX (DEPARTMENT_ID) JHIST_EMPLOYEE_IX (EMPLOYEE_ID) JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID. START_DATE) JHIST JOB_IX (JOB_ID) Primary key Constraint Name Foreign Key Constraint Names ICS120 X01_W21. DEPARTMENTS P. DEPARTMENT ID NUMBER (4) DEPARTMENT_NAME VARCHAR2 (30 BYTE) F MANAGER_ID NUMBER (0) F LOCATION_ID NUMBER (4) DEPT_ID_PK (DEPARTMENT_ID) DEPT_LOC_FK (LOCATION_ID) DEPT_MGR_FK (MANAGER_ID) DEPT_ID_PK (DEPARTMENT_ID) DEPT_LOCATION_IX (LOCATION_ID) Index Names OM - CITY ICS120X01_W21. LOCATIONS P LOCATION_ID NUMBER (4) STREET_ADDRESS VARCHAR2 (40 BYTE) POSTAL_CODE VARCHAR2(12 BYTE) VARCHAR2 (30 BYTE) STATE_PROVINCE VARCHAR2 (25 BYTE) F COUNTRY_ID CHAR 2 BYTE) >> LOC_ID_PK (LOCATION_ID) LOC_C_ID_FK (COUNTRY_ID) LOC_CITY_UX (CITY) LOC_COUNTRY_IX (COUNTRY_ID) LOC_ID_PK (LOCATION_ID) LOC_STATE_PROVINCE_IX (STATE_PROVINCE) ICS 120X01_W21.COUNTRIES P. COUNTRY_ID CHAR 2 BYTE) COUNTRY_NAME VARCHAR2 (40 BYTE) REGION_ID NUMBER COUNTRY_C_ID_PK (COUNTRY_ID) COUNTR_REO_FK (REGION_ID) ICS120X01_W21 REGIONS P. REGION_ID NUMBER REGION NAME VARCHAR2 (26 BYTE) REG_ID_PK (REGION_ID) REG_ID_PK (REGION_ID)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started