DML and DDL

     

  DATA - MANIPULATION LANGUAGE (DML)

A data - manipulation language(DML) is a language that allows us to access or manipulate data organized by the appropriate data model. 
It allows us to insert, delete, retrieve, or to modify the information stored in the database.

There are basically two types of DMLs:-

  • Procedural DMLs - it requires a user to specify what data are needed and how to get those data.
  • Declarative DMLs - it also requires a user to specify what data re needed. The only difference is that it does not how to get those data. 
Declarative DMLs are comparatively easier to us than procedural DMLs as the user does not need to specify how to get those data.A query is a statement requesting the retrieval of information. The portion of a DML that involves information retrieval is called a query language. A query takes as input several tables and always returns a single table. here is an example-       

         select instructor.name    
         from instructor             
         where instructor.dept_name = 'History'


The result of this query is a table with a single column labeled name, and a set of rows, each of which contains the name of an instructor whose dept_name, is History.

            DATA - DEFINITION LANGUAGE (DDL)

Data definition language(DML) is used to specify additional properties of the data. We specify the storage structure and access methods used bn the database system by a set of statements in a special type of DDL called data storage and definition language. These statements define the implementation details of the database schemas which are usually hidden from the users.
The data values stored in the database must satisfy certain consistency constraints. The DDL provides facilities to provide such constraints. The database system checks these constraints every time the database is updated.

SQL provides a rich DDL that allows the user to define tables, integrity constraints, assertions, etc.
For example, the below SQL DDL statements define the department table:-

        create table department
             (dept_name          char(20)
               building               char(15)
               budget                  numeric(12,2));

execution of the above DDL statement creates the department table with three columns :
dept_name, building, and budget, each of which has a specific data type associated with it.

Post a Comment

0 Comments