SlideShare uma empresa Scribd logo
1 de 27
DATABASE SYSTEM CONCEPTS AND ARCHITECTURES
Data Model
 1. Object based / High-level /
Conceptual data models
 2. Record based /
Representational /
Implementation data models
 3. Physical data model / low-
level data models
Types
A data model is a collection of
higher level data description
constraints that hides lower level
storage details – structure of DB
• Entity-Relationship Model
• Object-Oriented Data Model
• Hierarchical Model
• Network Model
• Relational Model
• conveys the core concepts and/or
principles of an organization in a
simple way, using concise descriptions
– user perceive the data
Describe how data is stored in the
computer
• Data is organized in the way of
easy to understand by end user
describes the storage of data in the computer by
representing information such as record formats, record
orderings and access path.
 Record Based
 N/W model : Like the
hierarchical model, this
model uses pointers
toward stored data.
However, it does not
necessarily use a
downward tree structure.
 Hierarchical data mode –
first DBMS model – data
store hierarchically -
downtree
 Relational model -data is stored in
two-dimensional tables (rows and
columns). The data is manipulated
based on the relational theory of
mathematics.
Schema and Instance
 Schema – Schema is the overall description of the database. The basic structure of how the data will be stored
in the database is called schema.
 Logical Schema – It describes the database designed at logical level.
 Physical Schema – It describes the database designed at physical level.
 Ex. Table name – teacher , DB name -school
 Table require attributes – name , doj, phoneno
 Name varchar2(50)
 Doj date
 Phoneno number
- Schema ( not changed)
 Instance - Instances are the collection of information stored at a particular moment
 Ex. Table name – teacher , DB name -school
 first day 50 records – now DB has 50 records
 Second day add another 50 records – now DB has 100 records
 - instance (changed)
Schema
Schema Instance
It is the overall description of the database.
It is the collection of information stored in a database
at a particular moment.
Schema is same for whole database.
Data in instances can be changed using addition,
deletion, updation.
Does not change Frequently. Changes Frequently.
Defines the basic structure of the database i.e how the
data will be stored in the database.
It is the set of Information stored at a particular time.
DBMS architecture and Data
independance
Database Languages
 Database languages can be used to read, store and update the data in
the database.
 A DBMS must provide appropriate languages and interfaces for each
category of users to express database queries and updates. Database
Languages are used to create and maintain database on computer.
 There are large numbers of database languages like Oracle, MySQL,
MS Access, dBase, FoxPro etc.
 SQL statements commonly used in Oracle and MS Access can be
categorized as DDL,DML,DCL and TCL.
DB Languages
SQL Statement
TCL –
Transaction
Control
Language
DCL- Data
Control
Language
DDL- Data
Definition
Language
DML – Data
Manipulation
Language
CREATE
ALTER
DROP
TRUNCATE
RENAME
COMMENT
GRANT
REVOKE
COMMIT
ROLLBACK
(
SAVEPOIN
T )
SELECT
INSERT
UPDATE
DELETE
MERGE
DDL -It is used to create schema,
tables, indexes, constraints, etc. in the
database.
 Create: It is used to create objects in the database.
 Create table tablename(var1/attri datatype, var2 datatype );
 Create table student(regno number , name varchar2(20));
 Alter: It is used to alter the structure of the database.
 Alter table tablename add attribute datatype;
 Alter table student add phoneno number;
 Alter table tablename modify attribute datatype;
 Alter table student modify regno varchar2(20);
 Alter table tablename drop column attributename;
 alter table student drop column name; / alter table student drop name;
 Drop: It is used to delete objects from the database.
 Alter table tablename drop column attributename;
 alter table student drop column name; / alter table student drop name;
 Truncate: It is used to remove all records
from a table.
 Truncate table tablename;
 Truncate table student;
 Rename: It is used to rename an object.
 Alter table tablename rename column oldname to
newname;
 Alter table student rename column regno to
registernumber;
 Comment: It is used to comment on the data
dictionary. ( statement will not be executed)
 Single line comments start with --.
 -- this is example for single line comment
 Multiline comment start with /* and end with */
 /* This is example for multiline comment
 This statement is not executed */
DML -used for accessing and manipulating data in
a database. It handles user requests.
 Select: It is used to retrieve data from a database.
 Select * from tablename;
 Select * from student;
 Insert: It is used to insert data into a table.
 Insert into tablename (attribute1, attribute 2) values (value for attr 1, value
for attribu2); / insert into tablename values ( value for attr1,value for attr2);
 Insert into student(regno,name) values ( 121,’asha’); / insert into values
(121,’asha’);
 Update: It is used to update existing data within a table.
 Update tablename set column2= value2 where condition;
 Update student set name= ‘mala’ where regno=121;
 table_name: name of the table
 column1: name of first , second, third column....
 value1: new value for first, second, third column....
 condition: condition to select the rows for which the values of columns
needs to be updated.
 Delete: It is used to
delete all records from a
table.
◦ Delete table tablename;
 Delete table student;
◦ DELETE FROM
table_name WHERE
some_condition;
 Delete from student where
regno=121;
◦ table_name: name of the
table
◦ some_condition: condition
MERGE
DCL -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.)
 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, EXECUTE, DELETE, UPDATE and SELECT.
Grant
 You can grant users various privileges to tables. These
permissions can be any combination of SELECT, INSERT,
UPDATE, DELETE, REFERENCES, ALTER, or ALL.
 Syntax:
 GRANT privileges ON object TO user;

Object: The name of the database object that you are granting
permissions for. In the case of granting privileges on a table, this
would be the table name.
User: The name of the user that will be granted these privileges.
Privilege Description
SELECT Ability to perform SELECT statements on the table.
INSERT Ability to perform INSERT statements on the table.
UPDATE Ability to perform UPDATE statements on the table.
DELETE Ability to perform DELETE statements on the table.
REFERENCES Ability to create a constraint that refers to the table.
ALTER Ability to perform ALTER TABLE statements to change the table definition.
ALL
ALL does not grant all permissions for the table. Rather, it grants the ANSI-92
permissions which are SELECT, INSERT, UPDATE, DELETE, and REFERENCES.
 For example, if you wanted to grant SELECT, INSERT, UPDATE, and DELETE
privileges on a table called employees to a user name smithj, you would run the
following GRANT statement:
 GRANT SELECT, INSERT, UPDATE, DELETE ON employees TO smithj;
 You can also use the ALL keyword
 (ie: SELECT, INSERT, UPDATE, DELETE, and REFERENCES) to a user named smithj.
For example:
 GRANT ALL ON employees TO smithj;
 If you wanted to grant only SELECT access on the employees table to all users, you
could grant the privileges to the public role. For example:
 GRANT SELECT ON employees TO public;
Revoke
 Once you have granted privileges, you may need to revoke
some or all of these privileges. To do this, you can run a
revoke command.
 You can revoke any combination of SELECT, INSERT,
UPDATE, DELETE, REFERENCES, ALTER, or ALL.
 Syntax
 REVOKE privileges ON object FROM user;
Object: The name of the database object that you are revoking
privileges for. In the case of revoking privileges on a table, this would
be the table name.
user: The name of the user that will have these privileges revoked.
Privilege Description
SELECT
Ability to perform SELECT statements
on the table.
INSERT
Ability to perform INSERT statements on
the table.
UPDATE
Ability to perform UPDATE statements
on the table.
DELETE
Ability to perform DELETE statements
on the table.
REFERENCES
Ability to create a constraint that
refers to the table.
ALTER
Ability to perform ALTER TABLE
statements to change the table
definition.
ALL
ALL does not revoke all permissions for
the table. Rather, it revokes the ANSI-
92 permissions which are SELECT,
INSERT, UPDATE, DELETE, and
REFERENCES.
 For example, if you wanted to revoke DELETE privileges on a table called employees from a user
named anderson, you would run the following REVOKE statement:
 REVOKE DELETE ON employees FROM anderson;
 If you wanted to revoke ALL ANSI-92 permissions (ie: SELECT, INSERT, UPDATE, DELETE, and
REFERENCES) on a table for a user named anderson, you could use the ALL keyword as follows:
 REVOKE ALL ON employees FROM anderson;
 If you had granted SELECT privileges to the public role (ie: all users) on the employees table and you
wanted to revoke these privileges, you could run the following REVOKE statement:
 REVOKE SELECT ON employees FROM public;

TCL -used to run the changes made by the
DML statement. TCL can be grouped into a
logical transaction.
 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.
 Savepoint : Used for large transaction
Commit
 Everything saved
Syntax:
 Commit;
 By default, automatic commit for DML commands is off.
Syntax:
set autocommit on; -- and to turn it off
set autocommit off;
ROLLBACK
 No use if it execute after commit
 Syntax:
Rollback [to savepoint <savepointname >];
 savepoint is an optional parameter
Syntax:
 Savepoint <savepointname>;
Save point is quite useful as it divides longer
transactions into smaller parts and marks certain
points of a transaction as checkpoints.
is the name given to the
save point created during
the transaction and is user-
defined.
like save
like undo
Rollback
 TRANSACTION PROPERTIES : ACID
 Atomicity − ensures that all operations within the work unit are completed successfully.
Otherwise, the transaction is aborted at the point of failure and all the previous
operations are rolled back to their former state.
 Consistency − ensures that the database properly changes states upon a successfully
committed transaction.
 Isolation − enables transactions to operate independently of and transparent to each
other.
 Durability − ensures that the result or effect of a committed transaction persists in case
of a system failure.
THANK YOU..

Mais conteúdo relacionado

Semelhante a Database models and DBMS languages

Semelhante a Database models and DBMS languages (20)

introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
Sql smart reference_by_prasad
Sql smart reference_by_prasadSql smart reference_by_prasad
Sql smart reference_by_prasad
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with ExamplesDML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
DML, DDL, DCL ,DRL/DQL and TCL Statements in SQL with Examples
 
unit-5 sql notes.docx
unit-5 sql notes.docxunit-5 sql notes.docx
unit-5 sql notes.docx
 
PostgreSQL Database Slides
PostgreSQL Database SlidesPostgreSQL Database Slides
PostgreSQL Database Slides
 
Oracle 11g SQL Overview
Oracle 11g SQL OverviewOracle 11g SQL Overview
Oracle 11g SQL Overview
 
Mysql
MysqlMysql
Mysql
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
MySQL Essential Training
MySQL Essential TrainingMySQL Essential Training
MySQL Essential Training
 
Module 3
Module 3Module 3
Module 3
 
Sql 
statements , functions & joins
Sql 
statements , functions  &  joinsSql 
statements , functions  &  joins
Sql 
statements , functions & joins
 
Lecture on DBMS & MySQL.pdf v. C. .
Lecture on DBMS & MySQL.pdf v.  C.     .Lecture on DBMS & MySQL.pdf v.  C.     .
Lecture on DBMS & MySQL.pdf v. C. .
 
mySQL and Relational Databases
mySQL and Relational DatabasesmySQL and Relational Databases
mySQL and Relational Databases
 
[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL[PHPUGPH] PHP Roadshow - MySQL
[PHPUGPH] PHP Roadshow - MySQL
 
lovely
lovelylovely
lovely
 
Mysql cheatsheet
Mysql cheatsheetMysql cheatsheet
Mysql cheatsheet
 
MySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and DefinitionsMySQL notes - Basic Commands and Definitions
MySQL notes - Basic Commands and Definitions
 
ADBMS Unit-II c
ADBMS Unit-II cADBMS Unit-II c
ADBMS Unit-II c
 

Mais de DivyaKS12

NUMBER SYSTEM.pptx
NUMBER SYSTEM.pptxNUMBER SYSTEM.pptx
NUMBER SYSTEM.pptxDivyaKS12
 
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptxDivyaKS12
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptxDivyaKS12
 
DBMS-INTRODUCTION.pptx
DBMS-INTRODUCTION.pptxDBMS-INTRODUCTION.pptx
DBMS-INTRODUCTION.pptxDivyaKS12
 
Operation research (definition, phases)
Operation research (definition, phases)Operation research (definition, phases)
Operation research (definition, phases)DivyaKS12
 
Types of Computer Modem
Types of Computer ModemTypes of Computer Modem
Types of Computer ModemDivyaKS12
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android DivyaKS12
 
Fragments In Android
Fragments In AndroidFragments In Android
Fragments In AndroidDivyaKS12
 
Android os(comparison all other mobile os)
Android os(comparison all other mobile os)Android os(comparison all other mobile os)
Android os(comparison all other mobile os)DivyaKS12
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java scriptDivyaKS12
 
Internet technology
Internet technologyInternet technology
Internet technologyDivyaKS12
 

Mais de DivyaKS12 (13)

NUMBER SYSTEM.pptx
NUMBER SYSTEM.pptxNUMBER SYSTEM.pptx
NUMBER SYSTEM.pptx
 
unit 3.pptx
unit 3.pptxunit 3.pptx
unit 3.pptx
 
PCCF UNIT 2.pptx
PCCF UNIT 2.pptxPCCF UNIT 2.pptx
PCCF UNIT 2.pptx
 
PCCF UNIT 1.pptx
PCCF UNIT 1.pptxPCCF UNIT 1.pptx
PCCF UNIT 1.pptx
 
DBMS-INTRODUCTION.pptx
DBMS-INTRODUCTION.pptxDBMS-INTRODUCTION.pptx
DBMS-INTRODUCTION.pptx
 
Operation research (definition, phases)
Operation research (definition, phases)Operation research (definition, phases)
Operation research (definition, phases)
 
Types of Computer Modem
Types of Computer ModemTypes of Computer Modem
Types of Computer Modem
 
UI controls in Android
UI controls in Android UI controls in Android
UI controls in Android
 
Fragments In Android
Fragments In AndroidFragments In Android
Fragments In Android
 
Android os(comparison all other mobile os)
Android os(comparison all other mobile os)Android os(comparison all other mobile os)
Android os(comparison all other mobile os)
 
Introduction to java script
Introduction to java scriptIntroduction to java script
Introduction to java script
 
CSS
CSSCSS
CSS
 
Internet technology
Internet technologyInternet technology
Internet technology
 

Último

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 

Último (20)

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 

Database models and DBMS languages

  • 1. DATABASE SYSTEM CONCEPTS AND ARCHITECTURES
  • 2. Data Model  1. Object based / High-level / Conceptual data models  2. Record based / Representational / Implementation data models  3. Physical data model / low- level data models Types A data model is a collection of higher level data description constraints that hides lower level storage details – structure of DB • Entity-Relationship Model • Object-Oriented Data Model • Hierarchical Model • Network Model • Relational Model • conveys the core concepts and/or principles of an organization in a simple way, using concise descriptions – user perceive the data Describe how data is stored in the computer • Data is organized in the way of easy to understand by end user describes the storage of data in the computer by representing information such as record formats, record orderings and access path.
  • 3.  Record Based  N/W model : Like the hierarchical model, this model uses pointers toward stored data. However, it does not necessarily use a downward tree structure.  Hierarchical data mode – first DBMS model – data store hierarchically - downtree  Relational model -data is stored in two-dimensional tables (rows and columns). The data is manipulated based on the relational theory of mathematics.
  • 4. Schema and Instance  Schema – Schema is the overall description of the database. The basic structure of how the data will be stored in the database is called schema.  Logical Schema – It describes the database designed at logical level.  Physical Schema – It describes the database designed at physical level.  Ex. Table name – teacher , DB name -school  Table require attributes – name , doj, phoneno  Name varchar2(50)  Doj date  Phoneno number - Schema ( not changed)  Instance - Instances are the collection of information stored at a particular moment  Ex. Table name – teacher , DB name -school  first day 50 records – now DB has 50 records  Second day add another 50 records – now DB has 100 records  - instance (changed)
  • 6. Schema Instance It is the overall description of the database. It is the collection of information stored in a database at a particular moment. Schema is same for whole database. Data in instances can be changed using addition, deletion, updation. Does not change Frequently. Changes Frequently. Defines the basic structure of the database i.e how the data will be stored in the database. It is the set of Information stored at a particular time.
  • 7. DBMS architecture and Data independance
  • 8.
  • 9. Database Languages  Database languages can be used to read, store and update the data in the database.  A DBMS must provide appropriate languages and interfaces for each category of users to express database queries and updates. Database Languages are used to create and maintain database on computer.  There are large numbers of database languages like Oracle, MySQL, MS Access, dBase, FoxPro etc.  SQL statements commonly used in Oracle and MS Access can be categorized as DDL,DML,DCL and TCL.
  • 10. DB Languages SQL Statement TCL – Transaction Control Language DCL- Data Control Language DDL- Data Definition Language DML – Data Manipulation Language CREATE ALTER DROP TRUNCATE RENAME COMMENT GRANT REVOKE COMMIT ROLLBACK ( SAVEPOIN T ) SELECT INSERT UPDATE DELETE MERGE
  • 11. DDL -It is used to create schema, tables, indexes, constraints, etc. in the database.  Create: It is used to create objects in the database.  Create table tablename(var1/attri datatype, var2 datatype );  Create table student(regno number , name varchar2(20));  Alter: It is used to alter the structure of the database.  Alter table tablename add attribute datatype;  Alter table student add phoneno number;  Alter table tablename modify attribute datatype;  Alter table student modify regno varchar2(20);  Alter table tablename drop column attributename;  alter table student drop column name; / alter table student drop name;  Drop: It is used to delete objects from the database.  Alter table tablename drop column attributename;  alter table student drop column name; / alter table student drop name;  Truncate: It is used to remove all records from a table.  Truncate table tablename;  Truncate table student;  Rename: It is used to rename an object.  Alter table tablename rename column oldname to newname;  Alter table student rename column regno to registernumber;  Comment: It is used to comment on the data dictionary. ( statement will not be executed)  Single line comments start with --.  -- this is example for single line comment  Multiline comment start with /* and end with */  /* This is example for multiline comment  This statement is not executed */
  • 12. DML -used for accessing and manipulating data in a database. It handles user requests.  Select: It is used to retrieve data from a database.  Select * from tablename;  Select * from student;  Insert: It is used to insert data into a table.  Insert into tablename (attribute1, attribute 2) values (value for attr 1, value for attribu2); / insert into tablename values ( value for attr1,value for attr2);  Insert into student(regno,name) values ( 121,’asha’); / insert into values (121,’asha’);  Update: It is used to update existing data within a table.  Update tablename set column2= value2 where condition;  Update student set name= ‘mala’ where regno=121;  table_name: name of the table  column1: name of first , second, third column....  value1: new value for first, second, third column....  condition: condition to select the rows for which the values of columns needs to be updated.  Delete: It is used to delete all records from a table. ◦ Delete table tablename;  Delete table student; ◦ DELETE FROM table_name WHERE some_condition;  Delete from student where regno=121; ◦ table_name: name of the table ◦ some_condition: condition
  • 13. MERGE
  • 14. DCL -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.)  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, EXECUTE, DELETE, UPDATE and SELECT.
  • 15. Grant  You can grant users various privileges to tables. These permissions can be any combination of SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER, or ALL.  Syntax:  GRANT privileges ON object TO user;  Object: The name of the database object that you are granting permissions for. In the case of granting privileges on a table, this would be the table name. User: The name of the user that will be granted these privileges.
  • 16. Privilege Description SELECT Ability to perform SELECT statements on the table. INSERT Ability to perform INSERT statements on the table. UPDATE Ability to perform UPDATE statements on the table. DELETE Ability to perform DELETE statements on the table. REFERENCES Ability to create a constraint that refers to the table. ALTER Ability to perform ALTER TABLE statements to change the table definition. ALL ALL does not grant all permissions for the table. Rather, it grants the ANSI-92 permissions which are SELECT, INSERT, UPDATE, DELETE, and REFERENCES.
  • 17.  For example, if you wanted to grant SELECT, INSERT, UPDATE, and DELETE privileges on a table called employees to a user name smithj, you would run the following GRANT statement:  GRANT SELECT, INSERT, UPDATE, DELETE ON employees TO smithj;  You can also use the ALL keyword  (ie: SELECT, INSERT, UPDATE, DELETE, and REFERENCES) to a user named smithj. For example:  GRANT ALL ON employees TO smithj;  If you wanted to grant only SELECT access on the employees table to all users, you could grant the privileges to the public role. For example:  GRANT SELECT ON employees TO public;
  • 18. Revoke  Once you have granted privileges, you may need to revoke some or all of these privileges. To do this, you can run a revoke command.  You can revoke any combination of SELECT, INSERT, UPDATE, DELETE, REFERENCES, ALTER, or ALL.  Syntax  REVOKE privileges ON object FROM user;
  • 19. Object: The name of the database object that you are revoking privileges for. In the case of revoking privileges on a table, this would be the table name. user: The name of the user that will have these privileges revoked. Privilege Description SELECT Ability to perform SELECT statements on the table. INSERT Ability to perform INSERT statements on the table. UPDATE Ability to perform UPDATE statements on the table. DELETE Ability to perform DELETE statements on the table. REFERENCES Ability to create a constraint that refers to the table. ALTER Ability to perform ALTER TABLE statements to change the table definition. ALL ALL does not revoke all permissions for the table. Rather, it revokes the ANSI- 92 permissions which are SELECT, INSERT, UPDATE, DELETE, and REFERENCES.
  • 20.  For example, if you wanted to revoke DELETE privileges on a table called employees from a user named anderson, you would run the following REVOKE statement:  REVOKE DELETE ON employees FROM anderson;  If you wanted to revoke ALL ANSI-92 permissions (ie: SELECT, INSERT, UPDATE, DELETE, and REFERENCES) on a table for a user named anderson, you could use the ALL keyword as follows:  REVOKE ALL ON employees FROM anderson;  If you had granted SELECT privileges to the public role (ie: all users) on the employees table and you wanted to revoke these privileges, you could run the following REVOKE statement:  REVOKE SELECT ON employees FROM public; 
  • 21. TCL -used to run the changes made by the DML statement. TCL can be grouped into a logical transaction.  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.  Savepoint : Used for large transaction
  • 22. Commit  Everything saved Syntax:  Commit;  By default, automatic commit for DML commands is off. Syntax: set autocommit on; -- and to turn it off set autocommit off;
  • 23. ROLLBACK  No use if it execute after commit  Syntax: Rollback [to savepoint <savepointname >];  savepoint is an optional parameter Syntax:  Savepoint <savepointname>; Save point is quite useful as it divides longer transactions into smaller parts and marks certain points of a transaction as checkpoints. is the name given to the save point created during the transaction and is user- defined. like save like undo
  • 24.
  • 26.  TRANSACTION PROPERTIES : ACID  Atomicity − ensures that all operations within the work unit are completed successfully. Otherwise, the transaction is aborted at the point of failure and all the previous operations are rolled back to their former state.  Consistency − ensures that the database properly changes states upon a successfully committed transaction.  Isolation − enables transactions to operate independently of and transparent to each other.  Durability − ensures that the result or effect of a committed transaction persists in case of a system failure.