SlideShare una empresa de Scribd logo
1 de 28
For Business Analysts
Database Basics
Database Management System
Why do we need Databases
To Store Data
To Read Data
Update Data
Delete Data
Why buy expensive DBMS
Store information in Excel
Why use database system?
Database Management System
Benefits
Multi user access.
Fast Data Access - Optimized algorithms.
Can survive system CRASH - Disaster recovery.
Multistep operations - Transaction support.
Advance security features.
Data consistency – rules for data structure
Allows indexing
DBMS and Databases
Different Types of DBMS
Hierarchical Database
Object Oriented Databases
Network Databases
Relational Databases
Different DBMS available in the marketplace
SQL Server
Oracle
DB2
MySQL
Database & DBMS relationship
Data Storage
Data is stored in TABLES
All major business entities may have their own
tables
Customer
Supplier
Products
Orders
Columns defines type-of-data, length-of-data
Each row uniquely identifies a customer, product,
or suppliers.
Table Structure
Primary Key
Unique identifier for a
row
Must contain a value
Unique Key
Uniquely defines a row
Can be NULL.
Name Address Phone Income
Paul Milpitas 408-102-
1111
55,000
Sam Fremont 510-102-
2222
85,000
Paul San Jose 95,000
Cust ID
1001
1002
1003
Common Terminology
Name Address Phone Income
Table = Relation
Row = Tuple
Column = Attribute = Field
Cardinality = Number of tuples
Degree = Number of attributes
Domain = Set of legal values for an attribute, for example
Gender attribute may have two legal values male/female
Normalization
Bad Design
Normalization
Anomalies
Insert
Modify
Delete
Normalization
What is normalization?
Split tables using specific rules to reduce
redundancy and avoid anomalies
Splitting tables may result in a performance hit while
accessing data.
Aim is to strike a balance between performance and
redundancy.
Example –
Highly Normalized structure may be used for applications
involving lot of transactions and/or complex transactions –
banking systems
Read only type of applications need not be highly
Normalized - websites
Normalization – 1nf
1st Normal Form
A relation is in 1nf if every attribute is atomic (not a
set or list)
Ord ID Date Time Location Amt $ Items
100 1/1/11 00:30 D101 12.25 Milk, Bread, Eggs
101 2/1/11 06:30 D025 725.7
5
Juice, iPad
102 3/1/11 12:30 D107 5.00 Shampoo, Soap
103 4/1/11 01:30 D022 18.50 Ink cartridge
104 5/1/11 02:30 D101 25.00 Banana, Oranges,
Milk
Normalization – 1nf
Ord ID Item
100 Milk
100 Bread
100 Eggs
101 Juice
101 iPad
103 Shampoo
103 Soap
104 Banana
104 Orange
104 Milk
Ord ID Date Time Location Amt $
100 1/1/11 00:30 D101 12.25
101 2/1/11 06:30 D025 725.7
5
102 3/1/11 12:30 D107 5.00
103 4/1/11 01:30 D022 18.50
104 5/1/11 02:30 D101 25.00
Composite P-
Key
1st Normal Form
- Eliminate repeating groups in individual
tables.
- Create a separate table for each set of
related data.
- Identify each set of related data with a
primary key.
Normalization – 1nf
Name City Phones 1 Phone 2
Sam Fremont 510-200-3000 NULL
Tom Concord 925-373-1212 925-255-1010
Bob Milpitas 408-408-2121 408-233-4545
Name City
Sam Fremont
Tom Concord
Bob Milpitas
Name Phone
Sam 510-200-3000
Tom 925-373-1212
Tom 925-255-1010
Bob 408-408-2121
Bob 408-233-4545
Normalization
2nd Normal Form
A relation is in 2NF if every non-prime attribute is
non-partially dependent on the Primary Key.
Relation meets 1NF
R. No Course # Course Grade
R100 C001 Maths A
R101 C002 Chem B+
R101 C003 Physics C
Normalization
3rd Normal Form
Normalization
Other Normal forms
Database Design
Data Flow Diagram (DFD)
Database Design
Common Design Patterns
Hierarchy
Master Detail
Registration
Lookups
Order
Common Flags
IsActive?
IsDeleted?
Data Access
DDL – Data Definition Language
Create, Alter, Drop, Truncate, Rename etc.
DCL – Data Control Language
Grant, Revoke
DML – Data Modification Language
Insert, Update, Delete etc.
DQL – Data Query Language
Select
SQL - Basic
Simple Selects (using single table)
Concept of ALIAS
Where Clause
Operators
SQL - Basic
Understand Grouping and Aggregation
Understand Having Clause
Difference between Having and Where
Understand NULL
Condition translates to Boolean true/false
SQL - Basic
Example – Simple Select with NULLs and
Aggregates
SQL - Joins
Link back to Normalization
Loss Less Join
SQL - Joins
Join using Where Clause
Understand Cartesian Product
Join Syntax
Write queries
SQL - Joins
Self Join
Types of JOINS
Inner Joins
Left Outer Join
Right Outer Join
Write queries
SQL - Transactions
ACID properties
Show transactions
Set Operations
Union
Intersection etc.
Write queries
Aggregations
Country
Aggregated
Data
Rule 1 - Column that is displayed AS-IS must
be added to the GROUP BY clause
Rule 2 – All other columns should be part of
AGGREGATE functions

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Database Presentation
Database PresentationDatabase Presentation
Database Presentation
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
Database Administration
Database AdministrationDatabase Administration
Database Administration
 
SQL
SQLSQL
SQL
 
Dbms and rdbms ppt
Dbms and rdbms pptDbms and rdbms ppt
Dbms and rdbms ppt
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 
Structured Query Language (SQL)
Structured Query Language (SQL)Structured Query Language (SQL)
Structured Query Language (SQL)
 
Introduction to databases
Introduction to databasesIntroduction to databases
Introduction to databases
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
MySQL and its basic commands
MySQL and its basic commandsMySQL and its basic commands
MySQL and its basic commands
 
Basic DBMS ppt
Basic DBMS pptBasic DBMS ppt
Basic DBMS ppt
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
Introduction of sql server indexing
Introduction of sql server indexingIntroduction of sql server indexing
Introduction of sql server indexing
 
Database and types of database
Database and types of databaseDatabase and types of database
Database and types of database
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
SQL commands
SQL commandsSQL commands
SQL commands
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
Data warehouse architecture
Data warehouse architectureData warehouse architecture
Data warehouse architecture
 
Relational databases vs Non-relational databases
Relational databases vs Non-relational databasesRelational databases vs Non-relational databases
Relational databases vs Non-relational databases
 

Similar a Database basics

Data Analysis using Data Flux
Data Analysis using Data FluxData Analysis using Data Flux
Data Analysis using Data FluxSunil Pai
 
Lecture 18
Lecture 18Lecture 18
Lecture 18Shani729
 
Ibm Optim Techical Overview 01282009
Ibm Optim Techical Overview 01282009Ibm Optim Techical Overview 01282009
Ibm Optim Techical Overview 01282009lucascibm
 
Implementing Change Systems in SQL Server 2016
Implementing Change Systems in SQL Server 2016Implementing Change Systems in SQL Server 2016
Implementing Change Systems in SQL Server 2016Douglas McClurg
 
When & Why\'s of Denormalization
When & Why\'s of DenormalizationWhen & Why\'s of Denormalization
When & Why\'s of DenormalizationAliya Saldanha
 
Optim test data management for IMS 2011
Optim test data management for IMS 2011Optim test data management for IMS 2011
Optim test data management for IMS 2011evgeni77
 
Intro to Database Design
Intro to Database DesignIntro to Database Design
Intro to Database DesignSondra Willhite
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemAbishek V S
 
PPT SQL CLASS.pptx
PPT SQL CLASS.pptxPPT SQL CLASS.pptx
PPT SQL CLASS.pptxAngeOuattara
 
Intro to Data warehousing lecture 10
Intro to Data warehousing   lecture 10Intro to Data warehousing   lecture 10
Intro to Data warehousing lecture 10AnwarrChaudary
 
Datawarehousing & DSS
Datawarehousing & DSSDatawarehousing & DSS
Datawarehousing & DSSDeepali Raut
 
CQRS introduction
CQRS introductionCQRS introduction
CQRS introductionYura Taras
 
Data base testing
Data base testingData base testing
Data base testingBugRaptors
 

Similar a Database basics (20)

4.Database Management System.pdf
4.Database Management System.pdf4.Database Management System.pdf
4.Database Management System.pdf
 
Data Analysis using Data Flux
Data Analysis using Data FluxData Analysis using Data Flux
Data Analysis using Data Flux
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
Ibm Optim Techical Overview 01282009
Ibm Optim Techical Overview 01282009Ibm Optim Techical Overview 01282009
Ibm Optim Techical Overview 01282009
 
Implementing Change Systems in SQL Server 2016
Implementing Change Systems in SQL Server 2016Implementing Change Systems in SQL Server 2016
Implementing Change Systems in SQL Server 2016
 
When & Why\'s of Denormalization
When & Why\'s of DenormalizationWhen & Why\'s of Denormalization
When & Why\'s of Denormalization
 
Optim test data management for IMS 2011
Optim test data management for IMS 2011Optim test data management for IMS 2011
Optim test data management for IMS 2011
 
Intro to Database Design
Intro to Database DesignIntro to Database Design
Intro to Database Design
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
PPT SQL CLASS.pptx
PPT SQL CLASS.pptxPPT SQL CLASS.pptx
PPT SQL CLASS.pptx
 
SOA the Oracle way
SOA the Oracle waySOA the Oracle way
SOA the Oracle way
 
Intro to Data warehousing lecture 10
Intro to Data warehousing   lecture 10Intro to Data warehousing   lecture 10
Intro to Data warehousing lecture 10
 
ITReady DW Day2
ITReady DW Day2ITReady DW Day2
ITReady DW Day2
 
Database
DatabaseDatabase
Database
 
Datawarehousing & DSS
Datawarehousing & DSSDatawarehousing & DSS
Datawarehousing & DSS
 
Lecture 3 note.pptx
Lecture 3 note.pptxLecture 3 note.pptx
Lecture 3 note.pptx
 
CQRS introduction
CQRS introductionCQRS introduction
CQRS introduction
 
Data base testing
Data base testingData base testing
Data base testing
 
Teradata a z
Teradata a zTeradata a z
Teradata a z
 
Sql Server 2000
Sql Server 2000Sql Server 2000
Sql Server 2000
 

Último

Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...Bertram Ludäscher
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.pptibrahimabdi22
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...HyderabadDolls
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...kumargunjan9515
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowgargpaaro
 
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...kumargunjan9515
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...HyderabadDolls
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themeitharjee
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1ranjankumarbehera14
 
20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdfkhraisr
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...Elaine Werffeli
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...HyderabadDolls
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangeThinkInnovation
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...gajnagarg
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...SOFTTECHHUB
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...gajnagarg
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...nirzagarg
 

Último (20)

Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...Fun all Day Call Girls in Jaipur   9332606886  High Profile Call Girls You Ca...
Fun all Day Call Girls in Jaipur 9332606886 High Profile Call Girls You Ca...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
High Profile Call Girls Service in Jalore { 9332606886 } VVIP NISHA Call Girl...
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
 
Kings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about themKings of Saudi Arabia, information about them
Kings of Saudi Arabia, information about them
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf20240412-SmartCityIndex-2024-Full-Report.pdf
20240412-SmartCityIndex-2024-Full-Report.pdf
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Vadodara [ 7014168258 ] Call Me For Genuine Models ...
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Satna [ 7014168258 ] Call Me For Genuine Models We ...
 

Database basics

  • 2. Database Management System Why do we need Databases To Store Data To Read Data Update Data Delete Data Why buy expensive DBMS Store information in Excel
  • 3. Why use database system? Database Management System Benefits Multi user access. Fast Data Access - Optimized algorithms. Can survive system CRASH - Disaster recovery. Multistep operations - Transaction support. Advance security features. Data consistency – rules for data structure Allows indexing
  • 4. DBMS and Databases Different Types of DBMS Hierarchical Database Object Oriented Databases Network Databases Relational Databases Different DBMS available in the marketplace SQL Server Oracle DB2 MySQL Database & DBMS relationship
  • 5. Data Storage Data is stored in TABLES All major business entities may have their own tables Customer Supplier Products Orders Columns defines type-of-data, length-of-data Each row uniquely identifies a customer, product, or suppliers.
  • 6. Table Structure Primary Key Unique identifier for a row Must contain a value Unique Key Uniquely defines a row Can be NULL. Name Address Phone Income Paul Milpitas 408-102- 1111 55,000 Sam Fremont 510-102- 2222 85,000 Paul San Jose 95,000 Cust ID 1001 1002 1003
  • 7. Common Terminology Name Address Phone Income Table = Relation Row = Tuple Column = Attribute = Field Cardinality = Number of tuples Degree = Number of attributes Domain = Set of legal values for an attribute, for example Gender attribute may have two legal values male/female
  • 10. Normalization What is normalization? Split tables using specific rules to reduce redundancy and avoid anomalies Splitting tables may result in a performance hit while accessing data. Aim is to strike a balance between performance and redundancy. Example – Highly Normalized structure may be used for applications involving lot of transactions and/or complex transactions – banking systems Read only type of applications need not be highly Normalized - websites
  • 11. Normalization – 1nf 1st Normal Form A relation is in 1nf if every attribute is atomic (not a set or list) Ord ID Date Time Location Amt $ Items 100 1/1/11 00:30 D101 12.25 Milk, Bread, Eggs 101 2/1/11 06:30 D025 725.7 5 Juice, iPad 102 3/1/11 12:30 D107 5.00 Shampoo, Soap 103 4/1/11 01:30 D022 18.50 Ink cartridge 104 5/1/11 02:30 D101 25.00 Banana, Oranges, Milk
  • 12. Normalization – 1nf Ord ID Item 100 Milk 100 Bread 100 Eggs 101 Juice 101 iPad 103 Shampoo 103 Soap 104 Banana 104 Orange 104 Milk Ord ID Date Time Location Amt $ 100 1/1/11 00:30 D101 12.25 101 2/1/11 06:30 D025 725.7 5 102 3/1/11 12:30 D107 5.00 103 4/1/11 01:30 D022 18.50 104 5/1/11 02:30 D101 25.00 Composite P- Key 1st Normal Form - Eliminate repeating groups in individual tables. - Create a separate table for each set of related data. - Identify each set of related data with a primary key.
  • 13. Normalization – 1nf Name City Phones 1 Phone 2 Sam Fremont 510-200-3000 NULL Tom Concord 925-373-1212 925-255-1010 Bob Milpitas 408-408-2121 408-233-4545 Name City Sam Fremont Tom Concord Bob Milpitas Name Phone Sam 510-200-3000 Tom 925-373-1212 Tom 925-255-1010 Bob 408-408-2121 Bob 408-233-4545
  • 14. Normalization 2nd Normal Form A relation is in 2NF if every non-prime attribute is non-partially dependent on the Primary Key. Relation meets 1NF R. No Course # Course Grade R100 C001 Maths A R101 C002 Chem B+ R101 C003 Physics C
  • 17. Database Design Data Flow Diagram (DFD)
  • 18. Database Design Common Design Patterns Hierarchy Master Detail Registration Lookups Order Common Flags IsActive? IsDeleted?
  • 19. Data Access DDL – Data Definition Language Create, Alter, Drop, Truncate, Rename etc. DCL – Data Control Language Grant, Revoke DML – Data Modification Language Insert, Update, Delete etc. DQL – Data Query Language Select
  • 20. SQL - Basic Simple Selects (using single table) Concept of ALIAS Where Clause Operators
  • 21. SQL - Basic Understand Grouping and Aggregation Understand Having Clause Difference between Having and Where Understand NULL Condition translates to Boolean true/false
  • 22. SQL - Basic Example – Simple Select with NULLs and Aggregates
  • 23. SQL - Joins Link back to Normalization Loss Less Join
  • 24. SQL - Joins Join using Where Clause Understand Cartesian Product Join Syntax Write queries
  • 25. SQL - Joins Self Join Types of JOINS Inner Joins Left Outer Join Right Outer Join Write queries
  • 26. SQL - Transactions ACID properties Show transactions
  • 28. Aggregations Country Aggregated Data Rule 1 - Column that is displayed AS-IS must be added to the GROUP BY clause Rule 2 – All other columns should be part of AGGREGATE functions