Professional Documents
Culture Documents
CS204: Database Systems Lab # 5: Introduction To SQL: Objective
CS204: Database Systems Lab # 5: Introduction To SQL: Objective
Objective:
Scope:
The student should know the following:
Understanding the complex logic
Useful Concepts :
FUNCTIONS: COUNT, MAX, MIN, AVG, SUM etc.
Display single aggregate record.
Ejaz Ahmed 1
Ejaz Ahmed 2
Ejaz Ahmed 3
Ejaz Ahmed 4
Outer Joins (Alternate solution for each query)
Ejaz Ahmed 5
Ejaz Ahmed 6
Exercises:
Ex. Display FirstName, Middle_names, FamilyName from Student table
Some names are two words, three words, four words.
Use Update SQL, to change salary of employee to 3500 who are from department SALES.
Additional examples:
for insert, delete and update use commit (DO)
rollback (UNDO)
update emp
set sal=1250
where ename='SMITH';
commit;
update emp
set hiredate=to_date('12/11/1998','dd/mm/yyyy'),
sal=1300,
comm=250
where ename='SMITH';
Ejaz Ahmed 7
SAL,
COMM,
DEPTNO)
values(
5544,
'Usman',
'CLERK',
7839,
to_date('24/12/2009','dd/mm/yyyy'),
4500,
null,
20
);
commit;
delete from emp
where empno=5544;
commit;
NEXT PAGE
Ejaz Ahmed 8
Ejaz Ahmed 9
Ejaz Ahmed 10
Add more valid CHECK constraints in this script.
Evaluation:
Your Lab Work grade will depend on your active participation, individual efforts in solving Lab
Problem (script exercise) and Seriousness during the lab.
Ejaz Ahmed 11