Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

LECTURE 3

DEFINE: INSTANCES & SCHEMAS


 Instances: The collection of information stored in the
database at a particular moment is called instance of the
database.

 Schema- The overall design of the Database is called the


Database Schema. It is specified during database design
and is not expected to change frequently .
DATABASE ADMINISTRATOR
 A person who has central control of both the Data and
programs that access those data over the system.
FUNCTIONS
1. Defining the Conceptual schema
2. Defining the Physical schema
3. Schema and Physical organization modification- It
carries out the changes or modifications to the
description of the Database or its relationships to the
physical organization of the Database or to alter the
physical organization to improve performance
4 – Granting of Authorization for data access
5 - Storage structure and Access – It defines the storage
structure of the database using data definition language
and the Access method of the Data from the Database.
6- Availability , Backup and Recovery – Availability
means that the Data must be available to all when it is
needed.
7- DBA enforces and maintains constrains to ensure
integrity of the Database.
8- Performance monitoring and Tuning – DBA must make
sure that Databases are fast and responsive
DATABASE LANGUAGE
 Three types of Database language –
1. Data definition language ( DDL)
2. Data manipulation Language
3. Data control Language
DATA DEFINITION LANGUAGE

 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.
 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.


DATA MANIPULATION LANGUAGE

 DML stands for Data Manipulation Language. It is used


for accessing and manipulating data in a database. It
handles user requests.

 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.


TYPES OF DML
 Procedural DML:It requires a user to specify what data
are needed and how to get those data

 Example:PL/SQL

 Non-Procedural DML:It specifies what data are needed


without specifying how to get those data.

 EXAMPLE: SQL
DATA CONTROL LANGUAGE

 DCL stands for Data Control Language. It is used to


retrieve the stored or saved data.It provides data
Security.

 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 is used to run the changes made by the DML


statement

 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.
DATA MODELS
 A collection of concepts that can be used to describe the
structure of Database , Datatypes and Relationships.
 Types of Data Models are –

1 – OBJECT BASED LOGICAL MODELS

Entity Relationship Model


2 – RECORD BASED LOGICAL MODEL

Relational Model Hierarchal Model Network Model


 The data contained in the database (e.g., entities:
students, lecturers, courses, subjects)
 The relationships between data items (e.g., students are
supervised by lecturers; lecturers teach courses)
 The constraints on data (e.g., student number has exactly
eight digits; a subject has four or six units of credit only)
ENTITY RELATIONSHIP MODEL
 An ER model is the logical representation of data as objects and
relationships among them. These objects are known as entities, and
relationship is an association among these entities.
 This model was designed by Peter Chen and published in 1976 papers.
It was widely used in database designing. A set of attributes describe
the entities.
 For example, student_name, student_id describes the 'student' entity. A
set of the same type of entities is known as an 'Entity set', and the set
of the same type of relationships is known as 'relationship set'.
CONT…
 Entity, Entity Type, Entity Set –
 An Entity may be an object with a physical existence – a
particular person, car, house, or employee – or it may be
an object with a conceptual existence – a company, a job,
or a university course.
 An Entity is an object of Entity Type and set of all
entities is called as entity set. e.g.; E1 is an entity having
Entity Type Student and set of all students is called
Entity Set. In ER diagram, Entity Type is represented as:
 Attribute(s):
Attributes are the properties which define the entity
type. For example, Roll_No, Name, DOB, Age, Address,
Mobile_No are the attributes which defines entity type
Student. In ER diagram, attribute is represented by an
oval.
TYPES OF ATTRIBUTES
 Key Attribute –
The attribute which uniquely identifies each entity in
the entity set is called key attribute.For example,
Roll_No will be unique for each student. In ER diagram,
key attribute is represented by an oval with underlying
lines.
COMPOSITE ATTRIBUTE
 Composite Attribute –
An attribute composed of many other attribute is
called as composite attribute. For example, Address
attribute of student Entity type consists of Street, City,
State, and Country. In ER diagram, composite attribute is
represented by an oval comprising of ovals.
MULTIVALUED ATTRIBUTE
 Multivalued Attribute –
An attribute consisting more than one value for a given
entity. For example, Phone_No (can be more than one
for a given student). In ER diagram, multivalued
attribute is represented by double oval.
DERIVED ATTRIBUTE
 Derived Attribute –
An attribute which can be derived from other
attributes of the entity type is known as derived
attribute. e.g.; Age (can be derived from DOB). In ER
diagram, derived attribute is represented by dashed oval.
RELATIONSHIP TYPES
 Relationship Type and Relationship Set:
A relationship type represents the association between
entity types. For example,‘Enrolled in’ is a relationship
type that exists between entity type Student and Course.
In ER diagram, relationship type is represented by a
diamond and connecting the entities with lines.

You might also like