0% found this document useful (0 votes)
10 views8 pages

Notes 2

Uploaded by

Roob Hood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
10 views8 pages

Notes 2

Uploaded by

Roob Hood
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

Module 1

DATA Language
A data sublanguage mainly has two parts:

Data Definition Language (DDL) and


Data Manipulation Language (DML).
The Data Definition Language is used for specifying the database schema, and the Data Manipulation
Language is used for both reading and updating the database.

Data Definition Language (DDL)


Data Definition Language (DDL) statements are used to classify the database structure or schema. It
is a type of language that allows the DBA or user to depict and name those entities, attributes, and
relationships that are required for the application along with any associated integrity and security
constraints.

● 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)


A language that offers a set of operations to support the fundamental data manipulation operations on
the data held in the database. Data Manipulation Language (DML) statements are used to manage
data within schema objects.

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)

● DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
● The DCL execution is transactional. It also has rollback parameters.

(But in Oracle database, the execution of data control language does not have the feature of rolling back.)

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.

There are the following operations which have the authorization of Revoke:

CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.

Transaction Control Language


Transaction Control statements are used to run the changes made by DML statements. It allows
statements to be grouped into logical transactions.

COMMIT - It saves the work done


SAVEPOINT - It identifies a point in a transaction to which you can later roll back
ROLLBACK - It restores the database to original since the last COMMIT
SET TRANSACTION - It changes the transaction options like isolation level and what
rollback segment to use.

Database administrator (DBA)


A database administrator (DBA) is the information technician responsible for directing or performing
all activities related to maintaining a successful database environment. A DBA makes sure an
organization's database and its related applications operate functionally and efficiently.
Importance of a DBA
If your organization uses a database management system (DBMS) for mission-critical workloads, it is
important to employ one or more database administrators to ensure that applications have ongoing,
uninterrupted access to data. Most modern organizations of every size use at least one DBMS, and
therefore the need for database administrators is greater today than ever before.
The DBA is responsible for understanding and managing the overall database environment. By
developing and implementing a strategic blueprint to follow when deploying databases within their
organization, DBAs are instrumental to the ongoing efficacy of modern applications that rely on
databases for data storage and access.

Database User Types


• Application Programmers are computer professionals interacting with the system through DML calls
embedded in a program written in a host language (e.g. C, PL/1, Pascal): These programs are called
Application Programs. The DML Precompiled converts DML calls (prefaced by a special character
like $, #, etc.) to normal procedure calls in a host language.

The host language compiler then generates the object code. Some special types of programming
languages combine Pascal-like control structures with control structures for the manipulation of a
database. These are sometimes called Fourth-Generation Languages. They often include features
which to generate forms and display data.

• Sophisticated Users interact with the system without writing programs :They form requests by
writing queries in a database query language. These are submitted to a query processor that breaks
a DML statement down into instructions for the database manager module.

• Specialized Users are sophisticated users writing special database application programs. These
may be CADD systems, knowledge-based and expert systems, complex data systems (audio/video),
etc.
• Naive Users are unsophisticated users who interact with the system by using permanent application
programs (e.g. automated teller machine).

DBMS Schema

Definition of schema: Design of a database is called the schema. Schema is of three types:
Physical schema, logical schema and view schema.

For example: In the following diagram, we have a schema that shows the relationship
between three tables: Course, Student and Section. The diagram only shows the design of
the database, it doesn’t show the data present in those tables. Schema is only a structural
view(design) of a database as shown in the diagram.

Advantages Database Schema

● You can manage data independent of the physical storage


● Faster Migration to new graphical environments
● DBMS Architecture allows you to make changes on the presentation level without
affecting the other two layers
● As each tier is separate, it is possible to use different sets of developers
● It is more secure as the client doesn't have direct access to the database business logic
● In case of the failure of the one-tier no data loss as you are always secure by accessing
the other tier

Disadvantages Database Schema

● Complete DB Schema is a complex structure which is difficult to understand for every


one
● Difficult to set up and maintain
● The physical separation of the tiers can affect the performance of the Database.

DBMS Instance

● Definition of instance: The data stored in database at a particular moment of time is


called instance of database. Database schema defines the variable declarations in
tables that belong to a particular database; the value of these variables at a moment of
time is called the instance of that database.
● For example, lets say we have a single table student in the database, today the table
has 100 records, so today the instance of the database has 100 records. Lets say we
are going to add another 100 records in this table by tomorrow so the instance of
database tomorrow will have 200 records in table. In short, at a particular moment the
data stored in database is called the instance, that changes over time when we add or
delete data from the database.

DBMS Schemas: Internal, Conceptual, External

Database systems comprise of complex data structures. Thus, to make the system
efficient for retrieval of data and reduce the complexity of the users, developers use the
method of Data Abstraction.

● There are mainly three levels of data abstraction:


● Internal Level: Actual PHYSICAL storage structure and access paths.
● Conceptual or Logical Level: Structure and constraints for the entire database
● External or View level: Describes various user views
Internal Level/Schema
The internal schema defines the physical storage structure of the database. The internal
schema is a very low-level representation of the entire database. It contains multiple
occurrences of multiple types of internal record. In the ANSI term, it is also called "stored
record'.

Facts about Internal schema:

● The internal schema is the lowest level of data abstraction


● It helps you to keeps information about the actual representation of the entire
database. Like the actual storage of the data on the disk in the form of records
● The internal view tells us what data is stored in the database and how

It never deals with the physical devices. Instead, internal schema views a physical device
as a collection of physical pages

Conceptual Schema/Level
The conceptual schema describes the Database structure of the whole database for the
community of users. This schema hides information about the physical storage structures
and focuses on describing data types, entities, relationships, etc.

This logical level comes between the user level and physical storage view. However, there
is only single conceptual view of a single database.

Facts about Conceptual schema:

● Defines all database entities, their attributes, and their relationships


● Security and integrity information
● In the conceptual level, the data available to a user must be contained in or
derivable from the physical level.

External Schema/Level
An external schema describes the part of the database which specific user is interested in.
It hides the unrelated details of the database from the user. There may be "n" number of
external views for each database. Each external view is defined using an external
schema, which consists of definitions of various types of external record of that specific
view.

An external view is just the content of the database as it is seen by some specific
particular user. For example, a user from the sales department will see only sales related
data.

Facts about external schema:

● An external level is only related to the data which is viewed by specific end users.
● This level includes some external schemas.
● External schema level is nearest to the user
● The external schema describes the segment of the database which is needed for a
certain user group and hides the remaining details from the database from the
specific user group

Goal of 3 schema of Database


Here, are some Objectives of using Three schema Architecture:

● Every user should be able to access the same data but able to see a customized
view of the data.
● The user need not to deal directly with physical database storage detail.
● The DBA should be able to change the database storage structure without
disturbing the user's views

● The internal structure of the database should remain unaffected when changes.
Made to the physical aspects of storage.

You might also like