SlideShare a Scribd company logo
TOPIC: DATABASE MANAGEMENT SYSTEM
AND SQL
S U B M I T T E D T O : S U B M I T T E D B Y :
S I R , N E E L E S H M I S H R A P A N K A J S I N G H
2 0 2 0 1 0 1 0 1 1 1 0 0 6 1
G R O U P - 5 2
3 R D Y E A R , 5 T S E M E S T E R
SHRI RAMSWAROOP
MEMORIAL UNIVERSITY
Database Management
Systems and SQL
What is a DBMS?
• Collection of interrelated data – manual or
computerized or online
• Set of programs to access the data
• DBMS provides an environment that is both
convenient and efficient to use.
3
Applications Areas of DBMS?
 Banking: all transactions
 Airlines: reservations, schedules
 Universities: registration, grades
 Sales: customers, products, purchases
 Manufacturing: production, inventory, orders, supply chain
 Human resources: employee records, salaries, tax
deductions
Databases touch all aspects of our lives
4
• To avoid data redundancy and inconsistency
Multiple file formats, duplication of information in
different files
• To avoid difficulty in accessing data
Need to write a new program to carry out each
new task
• To deal with data isolation — multiple files and
formats
• To deal with integrity problems
Integrity constraints (e.g. account balance > 0)
become part of program code
Easy to add new constraints or change existing
ones
Why do we use DBMS
5
1. Atomicity of updates
• Failures may leave database in an inconsistent state with partial
updates carried out
• E.g. transfer of funds from one account to another should either
complete or not happen at all
2. Concurrent access by multiple users
• Concurrent accessed needed for performance
• Uncontrolled concurrent accesses can lead to inconsistencies
o E.g. two people reading a balance and updating it at the same
time
3. Security problems
Why do we use DBMS (contd..)
6
Relational Model
Example of tabular data in the relational model
customer-
name
customer-id
customer-
street
customer-
city
account-
number
Johnson
Smith
Johnson
Jones
Smith
192-83-7465
019-28-3746
192-83-7465
321-12-3123
019-28-3746
Alma
North
Alma
Main
North
Palo Alto
Rye
Palo Alto
Harrison
Rye
A-101
A-215
A-201
A-217
A-201
Attributes
7
A Logically Related Database
8
Database Users
Users are differentiated by the way they expect to interact with the
system
• Application programmers – interact with system through DML
calls
• Sophisticated users – form requests in a database query
language
• Specialized users – write specialized database applications that
do not fit into the traditional data processing framework
• Naïve users – invoke one of the permanent application
programs that have been written previously
 E.g. people accessing database over the web, bank tellers, clerical staff
9
Database Administrator
• Coordinates all the activities of the database
system
• Has a good understanding of the enterprise’s
information resources and needs.
• Database administrator’s responsibilities include:
 Schema definition
 Storage structure and access method definition
 Schema and physical organization modification
 Granting user authority to access the database
 Specifying integrity constraints
 Acting as liaison with users
 Monitoring performance and responding to changes in
requirements
10
Transaction Management
• A transaction is a collection of operations that
performs a single logical function in a database
application
• Transaction-management component ensures that the
database remains in a consistent (correct) state
despite system failures (e.g., power failures and
operating system crashes) and transaction failures.
• Concurrency-control manager controls the interaction
among the concurrent transactions, to ensure the
consistency of the database.
11
Storage Management
• Storage manager is a program module that
provides the interface between the low-level
data stored in the database and the
application programs and queries submitted to
the system.
• The storage manager is responsible to the
following tasks:
interaction with the file manager
efficient storing, retrieving and updating of data
12
Overall
System
Structure
13
Application Architectures
Two-tier architecture: E.g. client programs using ODBC/JDBC
to communicate with a database
Three-tier architecture: E.g. web-based applications, and
applications built using “middleware”
14
DBMS: Allows to Create, Manipulate &
Access the Data
15
SQL
Structured Query Language
The Language of DBMS
Standard language for querying and manipulating
data. Very widely used.
1. Data Definition Language (DDL)
– Create/alter/delete tables and their attributes
2. Data Manipulation Language (DML)
– Insert/delete/modify tuples in tables
SQL
• SQL: widely used non-procedural language
– E.g. find the name of the customer with customer-id 192-83-7465
select customer.customer-name
from customer
where customer.customer-id = ‘192-83-7465’
– E.g. find the balances of all accounts held by the customer with
customer-id 192-83-7465
select account.balance
from depositor, account
where depositor.customer-id = ‘192-83-7465’ and
depositor.account-number = account.account-number
• Application programs generally access databases through one of
– Language extensions to allow embedded SQL
– Application program interface (e.g. ODBC/JDBC) which allow SQL
queries to be sent to a database 17
Tables in RDBMS
PName Price Category Manufacturer
Gizmo 19.99 Gadgets GizmoWorks
Powergizmo 29.99 Gadgets GizmoWorks
SingleTouch 149.99 Photography Canon
MultiTouch 203.99 Household Hitachi
Product
Attribute names
Table name
Tuples or rows 18
Steps to Define the Schema
PName Price Category Manufacturer
Gizmo 19.99 Gadgets GizmoWorks
Powergizmo 29.99 Gadgets GizmoWorks
SingleTouch 149.99 Photography Canon
MultiTouch 203.99 Household Hitachi
Product
Step 1: Define table name and its attributes
Product(PName, Price, Category, Manufacturer)
19
Basic data types
– Numeric
• Integer numbers: INTEGER, INT, and SMALLINT
• Floating-point (real) numbers: FLOAT or REAL, and
DOUBLE PRECISION
– Character-string
• Fixed length: CHAR(n), CHARACTER(n)
• Varying length: VARCHAR(n), CHAR VARYING(n),
CHARACTER VARYING(n)
Data Types and Domain of Attributes
Product(PName, Price, Category, Manfacturer)
20
Data Types and Domain of Attributes
– Boolean
• Values of TRUE or FALSE or NULL
– DATE
• Ten positions
• Components are YEAR, MONTH, and DAY in the
form YYYY-MM-DD
– Timestamp
• Includes the DATE and TIME fields
• Plus a minimum of six positions for decimal
fractions of seconds
• Optional WITH TIME ZONE qualifier 21
Step 2: Define Data Types and Domain of Attributes.
Product(PName, Price, Category, Manfacturer)
Pname : Varchar,
Price: Float,
Category: Varchar
Manfacturer: Varchar
Steps to Define the Schema
22
Constraints: Restrictions on values of
Attribute.
Step 3: Specifying Constraints.
Product(PName, Price, Category, Manfacturer)
• Specifying Key and Referential Integrity
Constraints
• Specifying Attribute and Domain Constraints
• Specifying Key Constraints
23
Specifying Attribute and Domain Constraints
• NOT NULL
NULL is not permitted for a particular attribute
• Default value
DEFAULT <value>
• CHECK clause
Dnumber > 0 AND Dnumber < 21;
• UNIQUE clause
Specifies attributes that have unique values 24
Specifying Key Constraints
• PRIMARY KEY clause
Specifies one or more attributes that make up the
primary key of a relation
 It is an attribute or a combination of attributes that
that uniquely identifies the records./tuples
e.g. roll_no, account_no, Id etc.
25
PRIMARY KEY = NOT NULL+ UNIQUE
Schema of Table Product
Product(Pname varchar Primary Key,
Price float Not Null,
Category varchar, check(Gadget, Photoraphy,
Household
Manufacturer varchar )
Attribute Data Type Constraints
Pname Varchar Primary Key
Price Float Not Null
Category Varchar Gadget,
Photography,
Household
Manufacturer Varchar
26

More Related Content

Similar to PANKAJ SINGH-061.pptx

DBMS introduction and functionality of of dbms
DBMS introduction and functionality of  of dbmsDBMS introduction and functionality of  of dbms
DBMS introduction and functionality of of dbms
ranjana dalwani
 
dbms intro
  dbms intro  dbms intro
dbms intro
Pooja Pathak
 
Introduction to DBMS.pptx
Introduction to DBMS.pptxIntroduction to DBMS.pptx
Introduction to DBMS.pptx
Sreenivas R
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
Vibrant Technologies & Computers
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Ch1
Ch1Ch1
Ch1CAG
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMSkoolkampus
 
Dbms and it infrastructure
Dbms and  it infrastructureDbms and  it infrastructure
Dbms and it infrastructureprojectandppt
 
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And Design
Lijo Stalin
 
Emerging Technologies in IT
Emerging Technologies in ITEmerging Technologies in IT
Unit1 dbms
Unit1 dbmsUnit1 dbms
Unit1 dbms
gowrivageesan87
 
Dbms
DbmsDbms
Dbms
saurav-IT
 
Unit-I_dbms_TT_Final.pptx
Unit-I_dbms_TT_Final.pptxUnit-I_dbms_TT_Final.pptx
Unit-I_dbms_TT_Final.pptx
UnknownUnknown252665
 
DownloadClassSessionFile (37).pdf
DownloadClassSessionFile (37).pdfDownloadClassSessionFile (37).pdf
DownloadClassSessionFile (37).pdf
HanaBurhan1
 

Similar to PANKAJ SINGH-061.pptx (20)

DBMS introduction and functionality of of dbms
DBMS introduction and functionality of  of dbmsDBMS introduction and functionality of  of dbms
DBMS introduction and functionality of of dbms
 
dbms intro
  dbms intro  dbms intro
dbms intro
 
Introduction to DBMS.pptx
Introduction to DBMS.pptxIntroduction to DBMS.pptx
Introduction to DBMS.pptx
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
 
Ch1
Ch1Ch1
Ch1
 
Ch1
Ch1Ch1
Ch1
 
Ch1 2
Ch1 2Ch1 2
Ch1 2
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Dbms and it infrastructure
Dbms and  it infrastructureDbms and  it infrastructure
Dbms and it infrastructure
 
unit 1.pdf
unit 1.pdfunit 1.pdf
unit 1.pdf
 
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And Design
 
Dbms chap i
Dbms chap iDbms chap i
Dbms chap i
 
Emerging Technologies in IT
Emerging Technologies in ITEmerging Technologies in IT
Emerging Technologies in IT
 
Unit1 dbms
Unit1 dbmsUnit1 dbms
Unit1 dbms
 
Unit 01 dbms
Unit 01 dbmsUnit 01 dbms
Unit 01 dbms
 
Dbms
DbmsDbms
Dbms
 
Unit-I_dbms_TT_Final.pptx
Unit-I_dbms_TT_Final.pptxUnit-I_dbms_TT_Final.pptx
Unit-I_dbms_TT_Final.pptx
 
DownloadClassSessionFile (37).pdf
DownloadClassSessionFile (37).pdfDownloadClassSessionFile (37).pdf
DownloadClassSessionFile (37).pdf
 
Krrushnan Resume - Mainframe (2)
Krrushnan Resume - Mainframe (2)Krrushnan Resume - Mainframe (2)
Krrushnan Resume - Mainframe (2)
 

Recently uploaded

Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 

Recently uploaded (20)

Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 

PANKAJ SINGH-061.pptx

  • 1. TOPIC: DATABASE MANAGEMENT SYSTEM AND SQL S U B M I T T E D T O : S U B M I T T E D B Y : S I R , N E E L E S H M I S H R A P A N K A J S I N G H 2 0 2 0 1 0 1 0 1 1 1 0 0 6 1 G R O U P - 5 2 3 R D Y E A R , 5 T S E M E S T E R SHRI RAMSWAROOP MEMORIAL UNIVERSITY
  • 3. What is a DBMS? • Collection of interrelated data – manual or computerized or online • Set of programs to access the data • DBMS provides an environment that is both convenient and efficient to use. 3
  • 4. Applications Areas of DBMS?  Banking: all transactions  Airlines: reservations, schedules  Universities: registration, grades  Sales: customers, products, purchases  Manufacturing: production, inventory, orders, supply chain  Human resources: employee records, salaries, tax deductions Databases touch all aspects of our lives 4
  • 5. • To avoid data redundancy and inconsistency Multiple file formats, duplication of information in different files • To avoid difficulty in accessing data Need to write a new program to carry out each new task • To deal with data isolation — multiple files and formats • To deal with integrity problems Integrity constraints (e.g. account balance > 0) become part of program code Easy to add new constraints or change existing ones Why do we use DBMS 5
  • 6. 1. Atomicity of updates • Failures may leave database in an inconsistent state with partial updates carried out • E.g. transfer of funds from one account to another should either complete or not happen at all 2. Concurrent access by multiple users • Concurrent accessed needed for performance • Uncontrolled concurrent accesses can lead to inconsistencies o E.g. two people reading a balance and updating it at the same time 3. Security problems Why do we use DBMS (contd..) 6
  • 7. Relational Model Example of tabular data in the relational model customer- name customer-id customer- street customer- city account- number Johnson Smith Johnson Jones Smith 192-83-7465 019-28-3746 192-83-7465 321-12-3123 019-28-3746 Alma North Alma Main North Palo Alto Rye Palo Alto Harrison Rye A-101 A-215 A-201 A-217 A-201 Attributes 7
  • 8. A Logically Related Database 8
  • 9. Database Users Users are differentiated by the way they expect to interact with the system • Application programmers – interact with system through DML calls • Sophisticated users – form requests in a database query language • Specialized users – write specialized database applications that do not fit into the traditional data processing framework • Naïve users – invoke one of the permanent application programs that have been written previously  E.g. people accessing database over the web, bank tellers, clerical staff 9
  • 10. Database Administrator • Coordinates all the activities of the database system • Has a good understanding of the enterprise’s information resources and needs. • Database administrator’s responsibilities include:  Schema definition  Storage structure and access method definition  Schema and physical organization modification  Granting user authority to access the database  Specifying integrity constraints  Acting as liaison with users  Monitoring performance and responding to changes in requirements 10
  • 11. Transaction Management • A transaction is a collection of operations that performs a single logical function in a database application • Transaction-management component ensures that the database remains in a consistent (correct) state despite system failures (e.g., power failures and operating system crashes) and transaction failures. • Concurrency-control manager controls the interaction among the concurrent transactions, to ensure the consistency of the database. 11
  • 12. Storage Management • Storage manager is a program module that provides the interface between the low-level data stored in the database and the application programs and queries submitted to the system. • The storage manager is responsible to the following tasks: interaction with the file manager efficient storing, retrieving and updating of data 12
  • 14. Application Architectures Two-tier architecture: E.g. client programs using ODBC/JDBC to communicate with a database Three-tier architecture: E.g. web-based applications, and applications built using “middleware” 14
  • 15. DBMS: Allows to Create, Manipulate & Access the Data 15
  • 16. SQL Structured Query Language The Language of DBMS Standard language for querying and manipulating data. Very widely used. 1. Data Definition Language (DDL) – Create/alter/delete tables and their attributes 2. Data Manipulation Language (DML) – Insert/delete/modify tuples in tables
  • 17. SQL • SQL: widely used non-procedural language – E.g. find the name of the customer with customer-id 192-83-7465 select customer.customer-name from customer where customer.customer-id = ‘192-83-7465’ – E.g. find the balances of all accounts held by the customer with customer-id 192-83-7465 select account.balance from depositor, account where depositor.customer-id = ‘192-83-7465’ and depositor.account-number = account.account-number • Application programs generally access databases through one of – Language extensions to allow embedded SQL – Application program interface (e.g. ODBC/JDBC) which allow SQL queries to be sent to a database 17
  • 18. Tables in RDBMS PName Price Category Manufacturer Gizmo 19.99 Gadgets GizmoWorks Powergizmo 29.99 Gadgets GizmoWorks SingleTouch 149.99 Photography Canon MultiTouch 203.99 Household Hitachi Product Attribute names Table name Tuples or rows 18
  • 19. Steps to Define the Schema PName Price Category Manufacturer Gizmo 19.99 Gadgets GizmoWorks Powergizmo 29.99 Gadgets GizmoWorks SingleTouch 149.99 Photography Canon MultiTouch 203.99 Household Hitachi Product Step 1: Define table name and its attributes Product(PName, Price, Category, Manufacturer) 19
  • 20. Basic data types – Numeric • Integer numbers: INTEGER, INT, and SMALLINT • Floating-point (real) numbers: FLOAT or REAL, and DOUBLE PRECISION – Character-string • Fixed length: CHAR(n), CHARACTER(n) • Varying length: VARCHAR(n), CHAR VARYING(n), CHARACTER VARYING(n) Data Types and Domain of Attributes Product(PName, Price, Category, Manfacturer) 20
  • 21. Data Types and Domain of Attributes – Boolean • Values of TRUE or FALSE or NULL – DATE • Ten positions • Components are YEAR, MONTH, and DAY in the form YYYY-MM-DD – Timestamp • Includes the DATE and TIME fields • Plus a minimum of six positions for decimal fractions of seconds • Optional WITH TIME ZONE qualifier 21
  • 22. Step 2: Define Data Types and Domain of Attributes. Product(PName, Price, Category, Manfacturer) Pname : Varchar, Price: Float, Category: Varchar Manfacturer: Varchar Steps to Define the Schema 22
  • 23. Constraints: Restrictions on values of Attribute. Step 3: Specifying Constraints. Product(PName, Price, Category, Manfacturer) • Specifying Key and Referential Integrity Constraints • Specifying Attribute and Domain Constraints • Specifying Key Constraints 23
  • 24. Specifying Attribute and Domain Constraints • NOT NULL NULL is not permitted for a particular attribute • Default value DEFAULT <value> • CHECK clause Dnumber > 0 AND Dnumber < 21; • UNIQUE clause Specifies attributes that have unique values 24
  • 25. Specifying Key Constraints • PRIMARY KEY clause Specifies one or more attributes that make up the primary key of a relation  It is an attribute or a combination of attributes that that uniquely identifies the records./tuples e.g. roll_no, account_no, Id etc. 25 PRIMARY KEY = NOT NULL+ UNIQUE
  • 26. Schema of Table Product Product(Pname varchar Primary Key, Price float Not Null, Category varchar, check(Gadget, Photoraphy, Household Manufacturer varchar ) Attribute Data Type Constraints Pname Varchar Primary Key Price Float Not Null Category Varchar Gadget, Photography, Household Manufacturer Varchar 26