You are on page 1of 3

Bahria University, Lahore Campus

Department of Computer Sciences


Lab Journal 04
(Fall 2022)

Course: Database Management System Lab

Course Code: CSL 220 Max Marks: 40

Faculty’s Name: Lab Engineer: Saadia Aslam

Name: Sami Haider Enroll No: 03-134211-038

Objectives
To Implement Data Manipulation Language (DML):
Data Manipulation Language (DML) statements are used for managing data within schema
objects.
 INSERT - insert data into a table
 UPDATE - updates existing data within a table
 DELETE - deletes all records from a table, the space for the records Remain

Task 1 30 Minutes
Write a SQL statement to create a simple table country including columns

 Country_id
 Country_name
 Region_id.

1. Write a SQL statement to insert a record into the table countries against each columns.
2. Write a SQL statement to insert one row into the table countries against the column country_id
and country_name.
3. Write a SQL statement to insert NULL values against region_id column for a row of countries
table.
4. Write a SQL statement to insert 3 rows by a single insert statement.
5. Insert 10 Rows at least in table country.

-- Task 1 :

insert into country values (1,'Singapore',52);


insert into country values (3,'Pakistan');

insert into country values (4,'USA');

insert into country values (5,'UK',53),(1,'SA',54),(1,'NZ',54);

insert into country values (5,'UK',53),(1,'SA',54),(1,'NZ',54),(5,'UK',53),(5,'UK',53),(5,'UK',53),(5,'UK',53),


(5,'UK',53);

Task 2 30 Minutes
Write a SQL statement to create a simple table countries including columns where job_id should be
unique
 JOB_ID,
 JOB_TITLE
 SALARY
1. Write a SQL statement to insert one row in jobs table to ensure that no duplicate value will be
entered in the job_id column
2. Insert 2 rows in table Jobs

insert into countries values (1,'Engineer',30000);


insert into countries values (2,'Manager',50000);

Task 3 30 Minutes
In this exercise, you will practice updating and deleting records.

Write a SQL statement to create a simple table Employee including columns


 FirstName
 Title
 Addresss
 City
 Region
 PostalCode
 Country
 HomePhone
 Extension
1. Insert 2 rows
2. Update the record in the Employees table.
3. Try to delete a record in Employees table. Could you?
4. DELETE a record FROM Employees WHERE FirstName = 'Ali'

-- Task 3 :

insert into Employee values ('Umer','SE','115-B','Lahore','Punjab',54000,'PK',12);

insert into Employee values ('Ahmed','SE','118-C','Lahore','Punjab',54000,'PK',12);

update Employee set FirstName = 'Sami'

where FirstName = 'Ahmed';

delete from Employee where FirstName='Sami';


insert into Employee values ('Ali','SE','118-C','Lahore','Punjab',54000,'PK',12);

delete from Employee where FirstName='Ali';

Task 4 30 Minutes
Create a table order with the given columns

 FirstName
 Title
 City
 PostalCode
 Country
 HomePhone
 OrderID
 ProductID
 UnitPrice
 Quantity
 Discount

1. Insert an order for yourself in the Orders table.


2. Insert an order for your friend

insert into Orderr values ('Umer','Heaphones','Lahore',54000,'PK',03334218,12,54,32,100,2)

insert into Orderr values ('Sami','Mouse','Lahore',54000,'PK',03334218,12,54,32,100,2)

Lab Grading Sheet :

Max Obtained
Task Comments(if any)
Marks Marks
1. 10
2. 10
3. 10
4. 10

Total 40 Signature

Note : Attempt all tasks and get them checked by your Lab. Instructor

You might also like