03 134192 002 8535071027 31032021 075354pm
03 134192 002 8535071027 31032021 075354pm
03 134192 002 8535071027 31032021 075354pm
Lahore Campus
Department of Computer Science
Database Management Systems (CSC-220)
Assignment No: 01
Total Marks: 20 Due Date: 31-03-2021
Objectives:
Q. No. Topics
1 Understand the SQL DDL and DML statements
Task:
You are required to write SQL queries for the given statement along with the report asked in deliverable A.
Deliverable:
1. A detailed report (approx. 700 words) to differentiate between the DDL and DML. (10 marks)
2. Detail SQL Queries (for given scenario) (10 marks)
Note: The work should be described in your own words. Avoid Plagiarism.
Criteria:
Assessment criteria
Grades E/F D C B A
-Identify very few/none of the most -Identify a few of the - Identify some of the - Identify most of the - Identify all of the
significant techniques. most significant most significant most significant most significant
Weak report. Basic contents and techniques. techniques with techniques. techniques with
lacks flow, structure and Reasonable report. respective references. Good report. proper examples.
understanding, or, no/poor, Reasonable Satisfactory report. Overall good Excellent report.
irrelevant report. Poor structure and presentation and Good presentation and presentation and Well-structured and
presentation. structure. structure. structure. presented.
TASK: 1 A detailed report (approx. 700 words) to differentiate between the DDL and DML. (10 marks)
Solution:
DDL DML
DDL Stands for Data Definition Language. DML Stands for Data Manipulation Language.
With the help of the create command, we With the help of the insert command, we can insert
can create databases and tables. data into the table.
Example: Example:
create table employee(ID int, EMP_Name insert into employee (ID,EMP_Name)
nvarchar(20),age int default 20); values(1,'Faizan'),(2,'Ali'),(3,'Rehman');
DDL enables us to identify relations, as well
DML is a data manipulation language.
as the schema for each one.
We can delete our database, tables, and We can delete data from our tables by using the
columns using the drop command. delete command.
Example: Example:
alter table employee drop column gender; delete from Employee where id =1;
With the help of the alter command, we can With the help of the update command, we can make
change our tables and columns. changes to the data in the table.
Example:
Example:
alter table employee add gender
update employee set gender='Male' where id =1;
nvarchar(10);
DML is used to INSERT, DELETE, and UPDATE table
DDL is primarily used to define the table's
rows. One tuple/Record is also referred to as one
attributes (columns).
row.
Procedural and non-procedural DML are the two
There is no further classification for DDL.
types of DML.
In DDL, the where clause is not used. In DML, the where clause is used.
With the sp rename command, we can The merge command in the database can be used to
rename our tables and columns. merge two tables.
create table Person(ID int, FirstName varchar(25), LastName varchar(25), City Varchar(20), Country
varchar(20));
insert into Person values(07,'Frederique','Citeaux','Strasbourg','France');
insert into Person values(08,'Martin','Sommer','Madrid','Spain');
insert into Person values(09,'Laurence','Lebihan','Marseille','France');
insert into Person values(18,'Janine','Labrune','Nantes','France');
insert into Person values(22,'Diego','Roel','Madrid','Spain');
insert into Person values(23,'Martine','Rance','Lille','France');
select * from Person;