Sie sind auf Seite 1von 13

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 1



a) Create table DEPT and EMP


b) Insert values into tables




SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 2




SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 3

c) List of all details of department



d) List salaries of all employees, showing only employee number & salary

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 4

e) List all employees with salary more than $2900


f) List all departments with department number 20 or 40


g) List all employees name with alphabet i as 2
nd
character.

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 5

h) List all employees name with alphabet s as last character


i) List all employees name with alphabet o in their name


j) Produce employees name with the smallest salary

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 6

k) Produce employees name with the biggest salary


l) Produce average salary for Salesman job


m) List employees name and its position who working for the 1
st
date.

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 7

n) List all employees details which occur during 1982.


o) List employees name and its position who working at last date


p) List all employees details which not occur in 1980




SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 8

q) List all employees name with alphabet j as 1
st
character


r) List all employees name and its position where manager employees number is null


s) Find number of employees as currently working




SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 9

t) List all employees name and salaries, ordered by salary descending


u) List all difference designations in the company






SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 10

v) List all current salaries in range $2000 to $ 3000, list their empNo, employee name and its
salaries descending.


w) List all employees name, job, department number, where its department number is 20, 30 and
40 using IN commands



SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 11

x) List all employee names, job, department number where its department number is not 20,30
and 40 using NOT IN command.


y) List all the employee names that have name J as 1
st
character and s as last character (single
name)


z) List all employees name that have alphabet M as 1
st
character or s as last character

SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 12

aa) List all employees name and its correspondingly uppercase.


bb) Update salary for President into 20% increase than current salary



SQL STATEMENT WEEK 3

Muhamad Zaid Bin Amirudin UK27719 13

cc) Update hiredate for employee number 7943 into 24/12/82 using yyyy-mm-dd format.
Displays new hiredate and employee number that corresponding it.

dd) Drop table employee and departmnet using SQL commands.

Das könnte Ihnen auch gefallen