0% found this document useful (0 votes)
162 views

Database Lab 5

Laptop and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be in a bit bro you so so much bro I got the same feeling a little under my name ?? I have been trying vadivelu you so very best for the kids to get a hold the power

Uploaded by

Daveiyn Nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
162 views

Database Lab 5

Laptop and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be there at gov and I will be in a bit bro you so so much bro I got the same feeling a little under my name ?? I have been trying vadivelu you so very best for the kids to get a hold the power

Uploaded by

Daveiyn Nathan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

ELECTRICAL ENGINEERING DEPARTMENT

ACADEMIC SESSION: DISEMBER 2019


DEC40073 – DATABASE SYSTEM

PRACTICAL SQL Data Manipulation Command - Functions And


WORK 5 : Operators
PRACTICAL
4 MARCH 2020
WORK DATE :
LECTURER’S
PUAN NURUL HUDA BINTI HANZAH
NAME:
GROUP NO. :
TOTAL
STUDENT ID & NAME : MARKS
(100%)

(1) NAGALECHUMY A/P BATHMANATHAN (18DTK18F1024)

(2)

(3)

(4)

DATE SUBMIT : 5 MARCH 2020 DATE RETURN :

Activity 5a: Comparison Operators


1. Create database.

2. Construct a table named Agent and Customer. Insert the values as below and
display both tables.

AGENT
COMMISION
3. Type the following commands and monitor the result:
a) SELECT AgentName FROM Agent WHERE Commision>2.00;
b) SELECT * FROM Agent WHERE Commision <1.00;

c) SELECT * FROM Agent WHERE Commision <=1.00;


a) SELECT * FROM AGENT WHERE COMMISION=1.00;

a) SELECT * FROM AGENT WHERE COMMISION!=1.00;

Activity 5b: Special Operators (BETWEEN, IN, LIKE)

a) SELECT * FROM Agent WHERE Commision BETWEEN 1.00 AND 2.00;


b) SELECT AgentName, WorkingArea FROM Agent WHERE WorkingArea
IN
(‘Penang’, ‘Kedah’);

c) SELECT * FROM Agent WHERE AgentName LIKE ‘A%’;


d) SELECT * FROM Agent WHERE WorkingArea LIKE ‘%s’;

Activity 5c: Logical Operators (AND, OR, NOT)

a) SELECT * FROM Agent


WHERE WorkingArea=’Kedah’
AND AgentName Like ‘F%’;
b) SELECT * FROM Agent
WHERE WorkingArea=’Penang’
OR AgentName Like ‘F%’;

c) SELECT AgentName, WorkingArea FROM Agent WHERE


WorkingArea NOT IN (‘Penang’, ‘Kedah’);
Activity 5d: MIN and MAX function
1. TABLE PRODUCT
2. Type the following command and display the result: SELECT MIN(UnitPrice)
FROM Product;
3. SELECT MAX(UnitPrice) FROM Product;

4. SELECT MIN(UnitPrice), MAX(UnitPrice) FROM Product;

Activity 5e: COUNT function

1. SELECT COUNT(Quantity)
FROM Product;
Activity 5f: AVG function

1. SELECT AVG(UnitPrice) FROM Product;

Activity 5g: SUM function

1. SELECT SUM(Quantity) FROM Product;


2. SELECT SUM(UnitPrice) AS TOTALPRICE FROM
Product;

DISCUSSION
EXERCISE 1

Construct Database.
Create Table.
1. Display the Student table.

1. Display the student names whose CGPA higher or equal to 3.50.


1. Display the student registration and names whose CGPA between 3.3
and 3.5.

1. Display the records of the students who are in the same batch. (e.g.:
18DEP13F1004 the underlined part indicated the batch)
‘12F1’

‘11f1’

2. Display the records of the students who are in the same batch in alphabetical
order.
3. Display the student names whose CGPA is higher than 3.00 and from
Penang.

4. Display the student names whose CGPA less than 3.70 or from “DTK”
program.

5. Display the all the student records except the student from “Sarawak”.
6. Display the highest and lowest CGPA.

7. Display number of student.


8. Display number of student whose program is “DEP”

9. Display average of CGPA and rename it as “Average of CGPA JKE” .


13. Display the sum and average of CGPA for “DEE” students.

You might also like