DDL and DML
DDL and DML
You are required to create a database for the Online Movie Rental Store. You are asked to write Create
Database and Create Table statements to create the physical structure of the requirements given in the attached
excel sheet. You are also required to choose the appropriate data types, select primary keys and foreign keys
within the different tables according to the data provided in the meta-data file (Excel file is given). You are
asked to insert at least 4 records in each table (as part of DML part).
Deliverable:
1. A detailed report (approx. 700 words) to differentiate between the DDL and DML. (10 marks)
2. Detail SQL Queries (for attached 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 a few of the - Identify some of the - Identify most of the - Identify all of the
-Identify very few/none of the most
most significant most significant most significant most significant
significant techniques.
techniques. techniques with techniques. techniques with proper
Weak report. Basic contents and lacks
Reasonable report. respective references. Good report. examples.
flow, structure and understanding, or,
Reasonable Satisfactory report. Overall good Excellent report.
no/poor, irrelevant report. Poor
presentation and Good presentation and presentation and Well-structured and
structure and presentation.
structure. structure. structure. presented.
PART(A): A detailed report (approx. 700 words) to differentiate between the DDL and
DML.
Introduction:
SQL Commands are divided in to two main groups Data Definition Language (DDL) and Data
Management Language (DML). It seems that Data-Definition Language and Data Manipulation
Language are different languages, but they are not different languages. Both Languages are
used in database systems. DDL statements are like a computer programming language for
defining data structures, especially database. DDL deals with the database Schemas and
Description that how data can be stored or reside in the database, hence in this case CREATE
TABLE, ALTER TABLE.ETC belongs to DDL. Whereas Data Management Language is used
to manage data which is stored into the Database. Like how we can Retrieve the Data, insert the
data into the Database and in context of SQL it is a popular data manipulation language which
is used to retrieve and manipulate data in a relational database. Now we briefly discuss
descriptive language and Data Manipulation language in SQL database.
DDL:
DDL stand for Data Definition Language it is used to create/modify database structures like
schemas, view, indexes, tables. It is also known as Data Description Language. Data Definition
Language is used to define attributes in the table. DDL is also considered as a subset of
SEQUEL When we define descriptive language in simple terms, we can define DDL language
used to describe data structure in the form table and its attributes. This language is part of the
logical schema. The Data Definition Language also provide the facility to specify some
constraints that would maintain the data consistency in the database. we can say that all the
physical work in the database possible through DDL. SQL statement cannot be rollback in DDL
which mean the process of restoring a database to a previously defined command is not possible
in DDL to recover the data from the error. Following are the Commands that are used by Data
Description Language
Example:
If we want to create the Structure of Database of Company, who sell some computer accessories
we will use the following commands to create database for that company
CREATE Company;
);
DML:
DML Stands for Data Manipulation Language. This is a subset of Structure Query Language.
Basically, this Data Manipulation Language is used to get data in or out from the databases.
Which mean it is used to manage the Data in databases. In simple terms, the use of "data
manipulation" language is a reasonable part of the database in which we set our queries. That is
why Language manipulation Language is part of the Logical Schema. DML is further classified
into two as Procedural and Non and Procedural DMLs. DML is used to add or update data in
the rows and these rows are also known tuples. By using DML Commands, it does not affect
the whole database it just works on the specified tuple and update it. DML is imperative
because without these commands you cannot manipulate the data that why it is very important.
Following are the Commands that are used by Data Description Language
Example:
As we create the structure of the table for Employees on upper example by using DDL.
Now we will add some data in that table using DML
Now if we want to Show that inserted data, we will use the Following DML command:
If we want to delete some data from table, we will use the following command:
);
INSERT INTO Price
VALUES
('codecx281',20),
('codecx632',35),
('codecx342',50),
('acodecx98',100);
(
vID varchar(1),
aID int,
Primary Key (vID,aID),
Foreign Key (vID) References Video(vID),
Foreign Key (aID) References Actor(aID),
);