0% found this document useful (0 votes)
29 views18 pages

Database Systems 3

DDL is used to define the structure of a database, DML is used to manipulate and retrieve data, and DCL and TCL control access privileges and transaction processing. There are three main data models - relational, hierarchical, and network. The relational model is the most widely used today and represents data in tables with rows and columns.

Uploaded by

Sameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views18 pages

Database Systems 3

DDL is used to define the structure of a database, DML is used to manipulate and retrieve data, and DCL and TCL control access privileges and transaction processing. There are three main data models - relational, hierarchical, and network. The relational model is the most widely used today and represents data in tables with rows and columns.

Uploaded by

Sameed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

IN The Name of Allah Almighty

Database Systems
Data Definition Language (DDL)
• DDL stands for Data Definition Language. It is used to define database structure or pattern.
• It is used to create schema, tables, indexes, constraints, etc. in the database.
• Using the DDL statements, you can create the skeleton of the database.
• Data definition language is used to store the information of metadata like the number of tables
and schemas, their names, indexes, columns in each table, constraints, etc.
• Here are some tasks that come under DDL:
• Create: It is used to create objects in the database.
• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
• Comment: It is used to comment on the data dictionary.
• These commands are used to update the database schema that's why they come under Data
definition language.
Data Manipulation Language (DML)

• DML stands for Data Manipulation Language. It is used for accessing and


manipulating data in a database. It handles user requests.
• Here are some tasks that come under DML:
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update operations.
• Call: It is used to call a structured query language or a Java subprogram.
• Explain Plan: It has the parameter of explaining data.
• Lock Table: It controls concurrency.
Data Control Language (DCL)

• Here are some tasks that come under DCL:


• Grant: It is used to give user access privileges to a database.
• Revoke: It is used to take back permissions from the user.
Transaction Control Language (TCL)

• TCL is used to run the changes made by the DML statement. TCL can be
grouped into a logical transaction.
• Here are some tasks that come under TCL:
• Commit: It is used to save the transaction on the database.
• Rollback: It is used to restore the database to original since the last Commit.
Why We Required a Data Model

• We mentioned earlier that a schema is written using a data definition language.


• In fact, it is written in the data definition language of a particular DBMS.
• Unfortunately, this type of language is too low level to describe the data
requirements of an organization in a way that is readily understandable by a
variety of users.
• What we require is a higher-level description of the schema: that is, a data model.
Data Model

• An integrated collection of concepts for describing and manipulating data,


relationships between data, and constraints on the data in an organization.
• The purpose of a data model is to represent data and to make the data
understandable. If it does this, then it can be easily used to design a
database.
Types of Data Models

• There are three principal types of record-based logical data models:


• Relational data model
• Network data model
• Hierarchical data model
Relational Data Model

• Most widely used model by commercial data processing applications.


• It uses tables for representing data and relationships among those data.
• Data is stored in tables called relations
• Each table is a group of columns and rows where columns represent attributes of an entity and row
represents records (tuples)
• Attribute or field: Each column in a relation is called an attribute. The values of attributes should be
from the same domain.
• Tuple or record: Each row in a relation is called a tuple. A tuple defines a collection of attribute values.
Hierarchical Data Model

• It was the first DBS Model


• In the hierarchical model data is stored in a tree-like structure with each record is having one
parent record and many children
• The main drawback of this model is that it can have only one too many relationships between
nodes.
• Rarely used now.
• Example is a course can be assigned to a single student
• However students can take multiple courses.
Network data model

• This model is an extension of the hierarchical model .it was the most popular model before
the relational model.
• Network model is the same as the hierarchical model except that it has a graph-like structure
rather than a tree-based structure and is allowed to have more than one parent node.
• Supports many to many relationships
• Widely used before the relational model.
• Example: a student has two parents node cs department and library----which further has
link with college.
Functions of a DBMS

• Data storage, retrieval, and update


• A DBMS must furnish users with the ability to store, retrieve, and update data in the database.

• A user-accessible catalog
• A DBMS must furnish a catalog in which descriptions of data items are stored and which
is accessible to users.
Functions of a DBMS

• Concurrency control services


• A DBMS must furnish a mechanism to ensure that the database is updated correctly
when multiple users are updating the database concurrently.
Functions of a DBMS

• Recovery services
• A DBMS must furnish a mechanism for recovering the database in the event that the
database is damaged in any way.
Functions of a DBMS

• Authorization services
• A DBMS must furnish a mechanism to ensure that only authorized users can access the
database
Functions of a DBMS

• Integrity services
• Database integrity refers to the correctness and consistency of stored data: it can be
considered as another type of database protection. While integrity is related to security, it
has wider implications: integrity is concerned with the quality of data itself
Summary

• We have discussed three levels of Architecture, data independence, types of


data independence, data model, types of data models, and functions of
DBMS.

You might also like