GUIDELINES
1. The assignment consists of 3 sections.
2. Solve the questions in SQL Developer & Save the file.
3. Solve all the questions.
4. Submit the entire answer file with proper order & question INT.
5. Submit the assignment in .sql format or in pdf format.
SECTION – 1
DDL - CREATE
1. Create the following tables
Given are the table_name, column_names, datatypes and size of column.
REGIONS
REGION_ID INT
REGION_NAME VARCHAR 25
COUNTRIES
COUNTRY_ID VARCHAR 2
COUNTRY_NAME VARCHAR 40
REGION_ID INT
LOCATIONS
LOCATION_ID INT
STREET_ADDRESS VARCHAR 40
POSTAL_CODE VARCHAR 40
CITY VARCHAR 30
STATE_PROVINCE VARCHAR 25
COUNTRY_ID VARCHAR 2
DEPARTMENTS
DEPARTMENT_ID INT
DEPARTMENT_NAM VARCHAR 30
E
MANAGER_ID INT
LOCATION_ID INT
JOBS
JOB_ID VARCHAR 10
JOB_TITLE VARCHAR 35
MIN_SALARY INT
MAX_SALARY INT
EMPLOYEES
EMPLOYEE_ID INT
FIRST_NAME VARCHAR 20
LAST_NAME VARCHAR 25
EMAIL VARCHAR 25
PHONE_INT VARCHAR 20
HIRE_DATE DATE
JOB_ID VARCHAR 10
SALARY INT
COMMISSION_PCT INT
MANAGER_ID INT
DEPARTMENT_ID INT
JOB_HISTORY
EMPLOYEE_ID INT
START_DATE DATE
END_DATE DATE
JOB_ID VARCHAR 10
DEPARTMENT_ID INT
SECTION - 2
DML - INSERT
1. Insert the given values in respective tables. REGIONS
(region_id,region_name)
1, Europe
2, Americas
3, Asia
4, Middle East and Africa
COUNTIRES (country_id, country_name, region_id)
'IT' , 'Italy' ,1
'JP' , 'Japan' ,3
'US' , 'United States of America' ,2
'CA' , 'Canada' ,2
'CN' , 'China' ,3
'IN' , 'India' ,3
'AU' , 'Australia' ,3
'ZW' , 'Zimbabwe' ,4
'SG' , 'Singapore' ,3
'UK' , 'United Kingdom' ,1
'FR' , 'France' ,1
'DE' , 'Germany' ,1
'ZM' , 'Zambia' ,4
'EG' , 'Egypt' ,4
'BR' , 'Brazil' ,2
LOCATIONS(location_id, street_address, postal_code, city, state_province, country_id)
1000 , '1297 Via Cola di Rie' , '00989' , 'Roma' , NULL , 'IT'
1100 , '93091 Calle della Testa' , '10934' , 'Venice' , NULL , 'IT'
1200 , '2017 Shinjuku-ku' , '1689' , 'Tokyo' , 'Tokyo Prefecture' , 'JP'
1300 , '9450 Kamiya-cho' , '6823' , 'Hiroshima' , NULL , 'JP'
1400 , '2014 Jabberwocky Rd' , '26192' , 'Southlake' , 'Texas' , 'US'
1500 , '2011 Interiors Blvd' , '99236' , 'South San Francisco' , 'California'
, 'US'
1600 , '2007 Zagora St' , '50090' , 'South Brunswick' , 'New Jersey' ,
'US'
1700 , '2004 Charade Rd' , '98199' , 'Seattle' , 'Washington' , 'US'
1800 , '147 Spadina Ave' , 'M5V 2L7' , 'Toronto' , 'Ontario' , 'CA'
DEPARTMENTS (department_id, department_name, manager_id, location_id)
10 , 'Administration' , 200 , 1700
20 , 'Marketing' , 201 , 1800
30 , 'Purchasing' , 114 , 1700
40 , 'Human Resources' , 203 , 2400
50 , 'Shipping' , 121 , 1500
60 , 'IT' , 103 , 1400
70 , 'Public Relations' , 204 , 2700
80 , 'Sales' , 145 , 2500
90 , 'Executive' , 100 , 1700
100 , 'Finance' , 108 , 1700
JOBS (job_id, job_title, min_salary, max_salary)
'AD_PRES' , 'President' , 20000 , 40000
'AD_VP' , 'Administration Vice President' , 15000 , 30000
'AD_ASST' , 'Administration Assistant' , 3000 , 6000
'FI_MGR' , 'Finance Manager' , 8200 , 16000
'FI_ACCOUNT' , 'Accountant' , 4200 , 9000
'AC_MGR' , 'Accounting Manager' , 8200 , 16000
'AC_ACCOUNT' , 'Public Accountant' , 4200 , 9000
'SA_MAN' , 'Sales Manager' , 10000 , 20000
'SA_REP' , 'Sales Representative' , 6000 , 12000
'PU_MAN' , 'Purchasing Manager' , 8000 , 15000
'PU_CLERK' , 'Purchasing Clerk' , 2500 , 5500
EMPLOYEES
(employee_id,first_name,last_name,email,phone_INT,hire_date,job_id,
salary,commission_pct, manager_id,department_id)
100 , 'Steven' , 'King' , 'sking@[Link]' , '515.123.4567' ,
STR_TO_DATE('17-06-1987', '%d-%m-%Y') , 'AD_PRES' , 24000 , NULL
, NULL , 90
101 , 'Neena' , 'Kochhar' , 'nkochhar@[Link]' , '515.123.4568' ,
STR_TO_DATE('21-09-1989', '%d-%m-%Y') , 'AD_VP' , 17000 , NULL ,
100 , 90
102 , 'Lex' , 'De Haan' , 'ldehaan@[Link]' , '515.123.4569' ,
STR_TO_DATE('13-01-1993', '%d-%m-%Y') , 'AD_VP' , 17000 , NULL ,
100 , 90
103 , 'Alexander' , 'Hunold' , 'ahunold@[Link]' , '590.423.4567' ,
STR_TO_DATE('03-01-1990', '%d-%m-%Y') , 'IT_PROG' , 9000 , NULL ,
102 , 60
JOB_HISTORY (employee_id, start_date,end_date,job_id, department_id)
102 , STR_TO_DATE('13-01-1993', '%d-%m-%Y') , STR_TO_DATE('24-07-1998',
'ddMON-yyyy') , 'IT_PROG' , 60
101 , STR_TO_DATE('21-09-1989', '%d-%m-%Y') , STR_TO_DATE('27-10-1993',
'ddMON-yyyy') , 'AC_ACCOUNT' , 110
101 , STR_TO_DATE('28-10-1993', '%d-%m-%Y') , STR_TO_DATE('15-MAR-
1997', 'ddMON-yyyy') , 'AC_MGR' , 110
201 , STR_TO_DATE('17-FEB-1996', '%d-%m-%Y') , STR_TO_DATE('19-DEC-
1999', 'ddMON-yyyy') , 'MK_REP' , 20
SECTION - 3
Select, Where, Order By, Case
1 Clear the screen.
2. Display all the employees.
3. Display all the employees by splitting your command in more than one line.
4. Display all the employees by splitting the keyword "SELECT" in more than one line.
5. Display all the departments.
6. Display all the tables in your users schema.
7. Display the structure of the employee table
8. Display the structure of all the tables present in yours users schema.
9.
a. Display all the jobs by eliminating the duplicate jobs.
b. Show the sum of 255 and 355.
[Link] each employees annual salary.
[Link] each employees annual salary by increasing salary to 250.
[Link] each employees name and job by using concatenation operator.