Database Languages

Two types of languages are there: 

1.  Data – Definition Language (DDL) 
2. Data – Manipulation Language (DML)

1. Data – Definition Language (DDL) 

A Data – Definition Language specifies the database schema by set of definitions. 
For example,

create table customer (cust_name char(20), cust_number integer, cust_address char(50), cust_city char(20), cust_pincode integer)

On executing the above DDL statement, the customer table is created and also updates special set of tables called the data dictionary or data directory. A data dictionary contains metadata, which is data about data. The example of the metadata is the schema of the table. Before modifying or reading actual data, the database system consults the data dictionary.
 
The implementation details of the database schema, which are hidden from the users, are defined by the data storage and definition language statements.

2. Data – Manipulation Language (DML) 

The Data – Manipulation Language expresses database queries and updates. It allows users to access or manipulate data using data models. Data manipulation performs four operations on the data stored in the database. 
  • Retrieval of information from database (Read)
  • Inserting new information in the database (Write) 
  • Deleting an existing information from database (Delete) 
  • Modifying information in the database (Update/Modify)
There are two types of Data – Manipulation Languages (DML):

  • Procedural DMLs: Requires users to specify what data is needed and how to access those data.
  • Declarative DMLs or Non – procedural DMLs: Requires user to specify what data is needed without specifying how to access those data.
A query language is used to retrieve information from the database using a query statement. For example,

select customer.cust_name from customer where customer.customer_id = 459

The above query specifies those rows from the customer table where customer_id = 459 and customer_name must be displayed. If query was executed on the table specified in Figure – 2 of Data models topic, the name Venkat would have been displayed. 

For example,

select account.balance from depositor, account where depositor.customer_id = 459 and depositor.account_number = account.account_number

The above query would display the result as Venkat and 60000, if it was executed on the table from Figure – 2 of the Data models topic. 

Comments

Popular posts from this blog

A university registrar’s office maintains data about the following entities: (a) courses, including number, title, credits, syllabus, and prerequisites; (b) course offerings, including course number, year, semester, section number, instructor(s), timings, and classroom; (c) students, including student-id, name, and program; and (d) instructors, including identification number, name, department, and title. Further, the enrolment of students in courses and grades awarded to students in each course they are enrolled for must be appropriately modelled. Construct an E-R diagram for the registrar’s office. Document all assumptions that you make about the mapping constraints.

Consider a database used to record the marks that students get in different exams of different course offerings.