SlideShare a Scribd company logo
1 of 40
IS-DBS 313
Presented By:
Dr. Rosemarie S. Guirre
Presented By: Dr. Rosemarie S. Guirre | IS-DBS-5
The Database Environment and
Development Process
Modeling Data in the Organization
Enhanced E-R Model
Logical Database Design and the Relational
Model
TOPIC
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Origins of the SQL Standard
SQL Statements
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-2
access and manipulate databases
standard of the American National
Standards Institute (ANSI) in 1986,
standard of the International Organization for
Standardization (ISO) in 1987
database computer language designed for
the retrieval and management of data in a
relational database
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
computer language for storing, manipulating
and retrieving data stored in a relational
database.
standard language for Relational Database
SystemExample: MySQL, MS Access,
Oracle, Sybase, Informix, Postgres and
SQL Server
different dialects like MS SQL Server using T-SQL,
ORACLE using PL/SQL MA ACCESS using JET SQL
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
execute queries against a database
retrieve data from a database
insert records in a database
update records in a database
delete records from a database
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
create new databases
create new tables in a database
create stored procedures in a
database
create views in a database
set permissions on tables,
procedures, and views
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
select
ANSI COMPLIANT
update
delete
insert
where
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
COMPONENTS
Optimization Engines
Classic Query Engine
SQL Query Engine
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
PHYSICAL
DB
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
commands to interact with relational
databases are CREATE, SELECT, INSERT,
UPDATE, DELETE and DROP
DDL - Data Definition Language
DML-Data Manipulation Language
DCL - Data Control Language
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
DDL - Data Definition Language
Sr.No. Command & Description
1
CREATE Creates a new table, a view of a table,
or other object in the database.
2
ALTER Modifies an existing database object,
such as a table.
3
DROP Deletes an entire table, a view of a table
or other objects in the database.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Sr.No. Command & Description
1
SELECT Retrieves certain records from
one or more tables.
2 INSERT Creates a record.
3 UPDATE Modifies records.
4 DELETE Deletes records.
DML-Data Manipulation Language
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Sr.No. Command & Description
1
GRANT
Gives a privilege to user.
2
REVOKE
Takes back privileges granted from user.
DCL - Data Control Language
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Relational Database Management System
database management system (DBMS)
that is based on the relational model as
introduced by E. F. Codd.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
The data in an RDBMS is stored in
database objects
Collection of related data entries
and it consists of numerous
columns and rows.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
guirre_bpc_campus guirre_course guirre_year_level guirre_section
ANGAT COMSEC 2 A
BOCAUE COMSEC 2 B
SAN MIGUEL HRS 2 B
SAN RAFAEL HRS 2 B
OBANDO COMSEC 1 A
PANDI EIM 1 A
BOCAUE CCS 2 B
MALOLOS COMSEC 1 A
Campus and Courses
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
guirre_bpc_campus guirre_course guirre_year_level guirre_section
Every table is broken up into
smaller entities called fields.
A field is a column in a table that
is designed to maintain specific
information about every record in
the table.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
A record is also called as a row of
data is each individual entry that
exists in a table.
A record is a horizontal entity in a
table.
BOCAUE CCS 2 B
MALOLOS COMSEC 1 A
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
A column is a vertical entity in a
table that contains all information
associated with a specific field in a
table.
guirre_bpc_campus
ANGAT
BOCAUE
SAN MIGUEL
SAN RAFAEL
MALOLOS
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
value in a field that appears to be
blank
a field with no value
a field with no value
value is the one that has been left
blank during a record creation.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
rules enforced on data columns
on a table
ensures the accuracy and
reliability of the data in the
database.
Column level constraints are applied
only to one column whereas, table level
constraints are applied to the entire
table.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
NOT NULL Constraint
Ensures that a column cannot have
a NULL value.
DEFAULT Constraint
Provides a default value for a
column when none is specified.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
UNIQUE Constraint
Ensures that all the values in a
column are different.
PRIMARY Key
Uniquely identifies each row/record
in a database table.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
FOREIGN Key
Uniquely identifies a row/record in
any another database table.
CHECK Constraint
The CHECK constraint ensures that
all values in a column satisfy certain
conditions.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
INDEX
Used to create and retrieve data
from the database very quickly.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Entity Integrity
There are no duplicate rows in a
table.
Domain Integrity
Enforces valid entries for a given
column by restricting the type, the
format, or the range of values.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Referential Integrity
Rows cannot be deleted, which are
used by other records.
User-Defined Integrity
Enforces some specific business
rules that do not fall into entity,
domain or referential integrity.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
process of efficiently organizing
data in a database
NORMALIZATION PROCESS
Eliminating redundant data
Ensuring data dependencies make sense
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
an attribute that specifies the
type of data of any object
Each column, variable and
expression has a related data
type in SQL
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Exact Numeric Data Types
Approximate Numeric Data Types
Date and Time Data Types
Character Strings Data Types
Unicode Character Strings Data Types
Binary Data Types
Misc Data Types
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Exact Numeric Data Types
bigint, int,smallint,tinyint,bit,decimal,
numeric,money and smallmoney
Approximate Numeric Data Types
float and real
Date and Time Data Types
datetime, smalldatetime, date,time
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Character Strings Data Types
char, varchar, varchar(max), text
Unicode Character Strings Data Types
nchar,nvarchar,nvarchar(max),ntext
Binary Data Types
binary, varbinary,varbinary(max),image
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Misc Data Types
sql variant,timestamp,uniqueindentifier
xml,cursor,table
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
reserved word or a character used
primarily in an SQL statement's
WHERE clause to perform operation(s),
such as comparisons and arithmetic
operations.
used to specify conditions in an SQL
statement and to serve as conjunctions
for multiple conditions in a statement.
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Arithmetic operators
Comparison operators
Logical operators
Operators used to negate
conditions
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Arithmetic operators
+ (Addition)
- (Subtraction)
* (Multiplication)
/ (Division)
% (Modulus)
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Comparison operators
=
!=
<>
>
<
>=
<=
!<
!>
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5
Logical operators
ALL
AND
ANY
BETWEEN
EXISTS
IN
LIKE
NOT
OR
IS NULL
UNIQUE
Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-4
END OF MODULE 5

More Related Content

What's hot

Supporting search as-you-type using sql in databases
Supporting search as-you-type using sql in databasesSupporting search as-you-type using sql in databases
Supporting search as-you-type using sql in databases
Ecway Technologies
 

What's hot (12)

Dbms
DbmsDbms
Dbms
 
SQL
SQL SQL
SQL
 
Supporting Transactions
Supporting TransactionsSupporting Transactions
Supporting Transactions
 
Supporting search as-you-type using sql in databases
Supporting search as-you-type using sql in databasesSupporting search as-you-type using sql in databases
Supporting search as-you-type using sql in databases
 
Search as-you-type (Exact search)
Search as-you-type (Exact search)Search as-you-type (Exact search)
Search as-you-type (Exact search)
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
JPJ1422 Fast Nearest Neighbour Search With Keywords
JPJ1422   Fast Nearest Neighbour Search With KeywordsJPJ1422   Fast Nearest Neighbour Search With Keywords
JPJ1422 Fast Nearest Neighbour Search With Keywords
 
Fast nearest neighbor search with keywords
Fast nearest neighbor search with keywordsFast nearest neighbor search with keywords
Fast nearest neighbor search with keywords
 
fast nearest neighbor search with keywords
fast nearest neighbor search with keywordsfast nearest neighbor search with keywords
fast nearest neighbor search with keywords
 
LinkedIn Resume
LinkedIn ResumeLinkedIn Resume
LinkedIn Resume
 
What are Data Models?
What are Data Models?What are Data Models?
What are Data Models?
 
DBMS-Quick Reference
DBMS-Quick ReferenceDBMS-Quick Reference
DBMS-Quick Reference
 

Similar to Introduction to SQL

Similar to Introduction to SQL (20)

RDBMS
RDBMS RDBMS
RDBMS
 
Normalization
NormalizationNormalization
Normalization
 
D B M S Animate
D B M S AnimateD B M S Animate
D B M S Animate
 
SQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics CoveredSQL Complete Tutorial. All Topics Covered
SQL Complete Tutorial. All Topics Covered
 
Ardbms
ArdbmsArdbms
Ardbms
 
BASIC_OF_DATABASE_PPT__new[1].pptx
BASIC_OF_DATABASE_PPT__new[1].pptxBASIC_OF_DATABASE_PPT__new[1].pptx
BASIC_OF_DATABASE_PPT__new[1].pptx
 
Dbms Basics
Dbms BasicsDbms Basics
Dbms Basics
 
DBMS Part-3.pptx
DBMS Part-3.pptxDBMS Part-3.pptx
DBMS Part-3.pptx
 
International Journal of Engineering Research and Development
International Journal of Engineering Research and DevelopmentInternational Journal of Engineering Research and Development
International Journal of Engineering Research and Development
 
RDMS AND SQL
RDMS AND SQLRDMS AND SQL
RDMS AND SQL
 
DBMS unit-3.pdf
DBMS unit-3.pdfDBMS unit-3.pdf
DBMS unit-3.pdf
 
Db fund
Db fundDb fund
Db fund
 
Dbms fundamentals
Dbms fundamentalsDbms fundamentals
Dbms fundamentals
 
week3.ppt
week3.pptweek3.ppt
week3.ppt
 
DB Design.ppt
DB Design.pptDB Design.ppt
DB Design.ppt
 
Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014
Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014
Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Unit 3 rdbms study_materials-converted
Unit 3  rdbms study_materials-convertedUnit 3  rdbms study_materials-converted
Unit 3 rdbms study_materials-converted
 
Lecture 2 sql {basics date type, constrains , integrity types etc.}
Lecture 2 sql {basics  date type, constrains , integrity types etc.}Lecture 2 sql {basics  date type, constrains , integrity types etc.}
Lecture 2 sql {basics date type, constrains , integrity types etc.}
 
SQL
SQLSQL
SQL
 

More from Dr. Rosemarie Sibbaluca-Guirre

More from Dr. Rosemarie Sibbaluca-Guirre (20)

Korean Language: Culture 한국어 개요
Korean Language: Culture 한국어 개요Korean Language: Culture 한국어 개요
Korean Language: Culture 한국어 개요
 
Korean Language Overview 한국어 개요
Korean Language Overview 한국어 개요Korean Language Overview 한국어 개요
Korean Language Overview 한국어 개요
 
Conjunction 접속사
Conjunction   접속사Conjunction   접속사
Conjunction 접속사
 
Pronoun 대명사
Pronoun  대명사Pronoun  대명사
Pronoun 대명사
 
Usage of Particles 입자의 사용
Usage of Particles 입자의 사용Usage of Particles 입자의 사용
Usage of Particles 입자의 사용
 
Usage of Particles 입자의 사용
Usage of Particles 입자의 사용Usage of Particles 입자의 사용
Usage of Particles 입자의 사용
 
Korean Word Order 한국어 단어 순서
Korean Word Order 한국어 단어 순서Korean Word Order 한국어 단어 순서
Korean Word Order 한국어 단어 순서
 
Korean Number 한국 번호
Korean Number 한국 번호Korean Number 한국 번호
Korean Number 한국 번호
 
ISAD 313-3_ TOOLS OF THE SYSTEM ANALYSIS.pptx
ISAD 313-3_ TOOLS OF THE SYSTEM ANALYSIS.pptxISAD 313-3_ TOOLS OF THE SYSTEM ANALYSIS.pptx
ISAD 313-3_ TOOLS OF THE SYSTEM ANALYSIS.pptx
 
ISAD 313-1_INTRODUCTION TO SYSTEMS.pptx
ISAD 313-1_INTRODUCTION TO SYSTEMS.pptxISAD 313-1_INTRODUCTION TO SYSTEMS.pptx
ISAD 313-1_INTRODUCTION TO SYSTEMS.pptx
 
ISAD 313-2_ SYSTEM ANALYSIS.pptx
ISAD 313-2_ SYSTEM ANALYSIS.pptxISAD 313-2_ SYSTEM ANALYSIS.pptx
ISAD 313-2_ SYSTEM ANALYSIS.pptx
 
ISAD 313-4_ RESEARCH PROJECT.pptx
ISAD 313-4_ RESEARCH PROJECT.pptxISAD 313-4_ RESEARCH PROJECT.pptx
ISAD 313-4_ RESEARCH PROJECT.pptx
 
ISAD 313-3_ SYSTEM FLOW.pptx
ISAD 313-3_ SYSTEM FLOW.pptxISAD 313-3_ SYSTEM FLOW.pptx
ISAD 313-3_ SYSTEM FLOW.pptx
 
ISAD 313-3_ MODELS.pptx
ISAD 313-3_ MODELS.pptxISAD 313-3_ MODELS.pptx
ISAD 313-3_ MODELS.pptx
 
ACCT11_9_Financial Position.pptx
ACCT11_9_Financial Position.pptxACCT11_9_Financial Position.pptx
ACCT11_9_Financial Position.pptx
 
ACCT11_8_Equity.pptx
ACCT11_8_Equity.pptxACCT11_8_Equity.pptx
ACCT11_8_Equity.pptx
 
ACCT11_7_Performance.pptx
ACCT11_7_Performance.pptxACCT11_7_Performance.pptx
ACCT11_7_Performance.pptx
 
ACCT11_6_Worksheet.pptx
ACCT11_6_Worksheet.pptxACCT11_6_Worksheet.pptx
ACCT11_6_Worksheet.pptx
 
ACCT11_5_Adjusting Entries.pptx
ACCT11_5_Adjusting Entries.pptxACCT11_5_Adjusting Entries.pptx
ACCT11_5_Adjusting Entries.pptx
 
ACCT11_4_Trial Balance.pptx
ACCT11_4_Trial Balance.pptxACCT11_4_Trial Balance.pptx
ACCT11_4_Trial Balance.pptx
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
CaitlinCummins3
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 

Recently uploaded (20)

An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of TransportBasic Civil Engineering notes on Transportation Engineering & Modes of Transport
Basic Civil Engineering notes on Transportation Engineering & Modes of Transport
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
Supporting Newcomer Multilingual Learners
Supporting Newcomer  Multilingual LearnersSupporting Newcomer  Multilingual Learners
Supporting Newcomer Multilingual Learners
 
The Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDFThe Story of Village Palampur Class 9 Free Study Material PDF
The Story of Village Palampur Class 9 Free Study Material PDF
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptxAnalyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
Analyzing and resolving a communication crisis in Dhaka textiles LTD.pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
SURVEY I created for uni project research
SURVEY I created for uni project researchSURVEY I created for uni project research
SURVEY I created for uni project research
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
male presentation...pdf.................
male presentation...pdf.................male presentation...pdf.................
male presentation...pdf.................
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 

Introduction to SQL

  • 1. IS-DBS 313 Presented By: Dr. Rosemarie S. Guirre
  • 2. Presented By: Dr. Rosemarie S. Guirre | IS-DBS-5 The Database Environment and Development Process Modeling Data in the Organization Enhanced E-R Model Logical Database Design and the Relational Model
  • 3. TOPIC Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Origins of the SQL Standard SQL Statements
  • 4. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-2 access and manipulate databases standard of the American National Standards Institute (ANSI) in 1986, standard of the International Organization for Standardization (ISO) in 1987 database computer language designed for the retrieval and management of data in a relational database
  • 5. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 computer language for storing, manipulating and retrieving data stored in a relational database. standard language for Relational Database SystemExample: MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL Server different dialects like MS SQL Server using T-SQL, ORACLE using PL/SQL MA ACCESS using JET SQL
  • 6. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 execute queries against a database retrieve data from a database insert records in a database update records in a database delete records from a database
  • 7. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 create new databases create new tables in a database create stored procedures in a database create views in a database set permissions on tables, procedures, and views
  • 8. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 select ANSI COMPLIANT update delete insert where
  • 9. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 COMPONENTS Optimization Engines Classic Query Engine SQL Query Engine
  • 10. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 PHYSICAL DB
  • 11. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 commands to interact with relational databases are CREATE, SELECT, INSERT, UPDATE, DELETE and DROP DDL - Data Definition Language DML-Data Manipulation Language DCL - Data Control Language
  • 12. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 DDL - Data Definition Language Sr.No. Command & Description 1 CREATE Creates a new table, a view of a table, or other object in the database. 2 ALTER Modifies an existing database object, such as a table. 3 DROP Deletes an entire table, a view of a table or other objects in the database.
  • 13. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Sr.No. Command & Description 1 SELECT Retrieves certain records from one or more tables. 2 INSERT Creates a record. 3 UPDATE Modifies records. 4 DELETE Deletes records. DML-Data Manipulation Language
  • 14. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Sr.No. Command & Description 1 GRANT Gives a privilege to user. 2 REVOKE Takes back privileges granted from user. DCL - Data Control Language
  • 15. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Relational Database Management System database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
  • 16. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 The data in an RDBMS is stored in database objects Collection of related data entries and it consists of numerous columns and rows.
  • 17. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 guirre_bpc_campus guirre_course guirre_year_level guirre_section ANGAT COMSEC 2 A BOCAUE COMSEC 2 B SAN MIGUEL HRS 2 B SAN RAFAEL HRS 2 B OBANDO COMSEC 1 A PANDI EIM 1 A BOCAUE CCS 2 B MALOLOS COMSEC 1 A Campus and Courses
  • 18. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 guirre_bpc_campus guirre_course guirre_year_level guirre_section Every table is broken up into smaller entities called fields. A field is a column in a table that is designed to maintain specific information about every record in the table.
  • 19. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 A record is also called as a row of data is each individual entry that exists in a table. A record is a horizontal entity in a table. BOCAUE CCS 2 B MALOLOS COMSEC 1 A
  • 20. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 A column is a vertical entity in a table that contains all information associated with a specific field in a table. guirre_bpc_campus ANGAT BOCAUE SAN MIGUEL SAN RAFAEL MALOLOS
  • 21. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 value in a field that appears to be blank a field with no value a field with no value value is the one that has been left blank during a record creation.
  • 22. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 rules enforced on data columns on a table ensures the accuracy and reliability of the data in the database. Column level constraints are applied only to one column whereas, table level constraints are applied to the entire table.
  • 23. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 NOT NULL Constraint Ensures that a column cannot have a NULL value. DEFAULT Constraint Provides a default value for a column when none is specified.
  • 24. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 UNIQUE Constraint Ensures that all the values in a column are different. PRIMARY Key Uniquely identifies each row/record in a database table.
  • 25. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 FOREIGN Key Uniquely identifies a row/record in any another database table. CHECK Constraint The CHECK constraint ensures that all values in a column satisfy certain conditions.
  • 26. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 INDEX Used to create and retrieve data from the database very quickly.
  • 27. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Entity Integrity There are no duplicate rows in a table. Domain Integrity Enforces valid entries for a given column by restricting the type, the format, or the range of values.
  • 28. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Referential Integrity Rows cannot be deleted, which are used by other records. User-Defined Integrity Enforces some specific business rules that do not fall into entity, domain or referential integrity.
  • 29. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 process of efficiently organizing data in a database NORMALIZATION PROCESS Eliminating redundant data Ensuring data dependencies make sense First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF)
  • 30. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 an attribute that specifies the type of data of any object Each column, variable and expression has a related data type in SQL
  • 31. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Exact Numeric Data Types Approximate Numeric Data Types Date and Time Data Types Character Strings Data Types Unicode Character Strings Data Types Binary Data Types Misc Data Types
  • 32. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Exact Numeric Data Types bigint, int,smallint,tinyint,bit,decimal, numeric,money and smallmoney Approximate Numeric Data Types float and real Date and Time Data Types datetime, smalldatetime, date,time
  • 33. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Character Strings Data Types char, varchar, varchar(max), text Unicode Character Strings Data Types nchar,nvarchar,nvarchar(max),ntext Binary Data Types binary, varbinary,varbinary(max),image
  • 34. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Misc Data Types sql variant,timestamp,uniqueindentifier xml,cursor,table
  • 35. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations. used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement.
  • 36. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Arithmetic operators Comparison operators Logical operators Operators used to negate conditions
  • 37. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Arithmetic operators + (Addition) - (Subtraction) * (Multiplication) / (Division) % (Modulus)
  • 38. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Comparison operators = != <> > < >= <= !< !>
  • 39. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-5 Logical operators ALL AND ANY BETWEEN EXISTS IN LIKE NOT OR IS NULL UNIQUE
  • 40. Presented By: Dr. Rosemarie S. Guirre | IS-DBS 313-4 END OF MODULE 5

Editor's Notes

  1. SQL is Structured Query Language, which is a computer language for storing, manipulating and retrieving data stored in a relational database. SQL is the standard language for Relational Database System. All the Relational Database Management Systems (RDMS) like MySQL, MS Access, Oracle, Sybase, Informix, Postgres and SQL Server use SQL as their standard database language. Also, they are using different dialects, such as − MS SQL Server using T-SQL, Oracle using PL/SQL, MS Access version of SQL is called JET SQL (native format) etc.
  2. What Can SQL do? SQL can execute queries against a database SQL can retrieve data from a database SQL can insert records in a database SQL can update records in a database SQL can delete records from a database
  3. What Can SQL do? SQL can create new databases SQL can create new tables in a database SQL can create stored procedures in a database SQL can create views in a database SQL can set permissions on tables, procedures, and views
  4. SQL is a Standard - BUT.... Although SQL is an American National Standards Institute (ANSI) /International Organization for Standardization (ISO) standard, there are different versions of the SQL language. However, to be compliant with the ANSI standard, they all support at least the major commands (such as SELECT, UPDATE, DELETE, INSERT, WHERE) in a similar manner.
  5. SQL Process When you are executing an SQL command for any RDBMS, the system determines the best way to carry out your request and SQL engine figures out how to interpret the task. There are various components included in this process. These components are − Query Dispatcher Optimization Engines Classic Query Engine SQL Query Engine, etc.
  6. SQL Commands The standard SQL commands to interact with relational databases are CREATE, SELECT, INSERT, UPDATE, DELETE and DROP. These commands can be classified into the following groups based on their nature −
  7. RDBMS stands for Relational Database Management System. RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access. A Relational database management system (RDBMS) is a database management system (DBMS) that is based on the relational model as introduced by E. F. Codd.
  8. What is a table? The data in an RDBMS is stored in database objects which are called as tables. This table is basically a collection of related data entries and it consists of numerous columns and rows. Remember, a table is the most common and simplest form of data storage in a relational database. The following program is an example of a CUSTOMERS table −
  9. What is a table? The data in an RDBMS is stored in database objects which are called as tables. This table is basically a collection of related data entries and it consists of numerous columns and rows. Remember, a table is the most common and simplest form of data storage in a relational database. The following program is an example of a CUSTOMERS table −
  10. A NULL value in a table is a value in a field that appears to be blank, which means a field with a NULL value is a field with no value. It is very important to understand that a NULL value is different than a zero value or a field that contains spaces. A field with a NULL value is the one that has been left blank during a record creation.
  11. SQL Constraints Constraints are the rules enforced on data columns on a table. These are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. Constraints can either be column level or table level. Column level constraints are applied only to one column whereas, table level constraints are applied to the entire table.
  12. Following are some of the most commonly used constraints available in SQL − NOT NULL Constraint − Ensures that a column cannot have a NULL value. DEFAULT Constraint − Provides a default value for a column when none is specified.
  13. Following are some of the most commonly used constraints available in SQL − UNIQUE Constraint − Ensures that all the values in a column are different. PRIMARY Key − Uniquely identifies each row/record in a database table.
  14. Following are some of the most commonly used constraints available in SQL − INDEX − Used to create and retrieve data from the database very quickly.
  15. Following are some of the most commonly used constraints available in SQL − INDEX − Used to create and retrieve data from the database very quickly.
  16. Data Integrity The following categories of data integrity exist with each RDBMS − Entity Integrity − There are no duplicate rows in a table. Domain Integrity − Enforces valid entries for a given column by restricting the type, the format, or the range of values.
  17. Data Integrity The following categories of data integrity exist with each RDBMS − Referential integrity − Rows cannot be deleted, which are used by other records. User-Defined Integrity − Enforces some specific business rules that do not fall into entity, domain or referential integrity.
  18. Database Normalization Database normalization is the process of efficiently organizing data in a database. There are two reasons of this normalization process − Eliminating redundant data, for example, storing the same data in more than one table. Ensuring data dependencies make sense. Both these reasons are worthy goals as they reduce the amount of space a database consumes and ensures that data is logically stored. Normalization consists of a series of guidelines that help guide you in creating a good database structure. It is your choice to take it further and go to the fourth normal form, fifth normal form and so on, but in general, the third normal form is more than enough. First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF)
  19. SQL Data Type is an attribute that specifies the type of data of any object. Each column, variable and expression has a related data type in SQL. You can use these data types while creating your tables. You can choose a data type for a table column based on your requirement.
  20. SQL Data Type is an attribute that specifies the type of data of any object. Each column, variable and expression has a related data type in SQL. You can use these data types while creating your tables. You can choose a data type for a table column based on your requirement.
  21. Note − Here, datetime has 3.33 milliseconds accuracy where as smalldatetime has 1 minute accuracy.
  22. DATA TYPE & Description char Maximum length of 8,000 characters.( Fixed length non-Unicode characters) varchar Maximum of 8,000 characters.(Variable-length non-Unicode data). varchar(max) Maximum length of 2E + 31 characters, Variable-length non-Unicode data (SQL Server 2005 only). text Variable-length non-Unicode data with a maximum length of 2,147,483,647 characters. UNICODE nchar Maximum length of 4,000 characters.( Fixed length Unicode) nvarchar Maximum length of 4,000 characters.(Variable length Unicode) nvarchar(max) Maximum length of 2E + 31 characters (SQL Server 2005 only).( Variable length Unicode) ntext Maximum length of 1,073,741,823 characters. ( Variable length Unicode ) Binary Data Types binary Maximum length of 8,000 bytes(Fixed-length binary data ) varbinary Maximum length of 8,000 bytes.(Variable length binary data) varbinary(max) Maximum length of 2E + 31 bytes (SQL Server 2005 only). ( Variable length Binary data) image Maximum length of 2,147,483,647 bytes. ( Variable length Binary Data)
  23. Misc Data Types sql_variant Stores values of various SQL Server-supported data types, except text, ntext, and timestamp. timestamp Stores a database-wide unique number that gets updated every time a row gets updated uniqueidentifier Stores a globally unique identifier (GUID) xml Stores XML data. You can store xml instances in a column or a variable (SQL Server 2005 only). cursor Reference to a cursor object table Stores a result set for later processing
  24. An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations. These Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement. Arithmetic operators Comparison operators Logical operators Operators used to negate conditions
  25. Arithmetic operators Comparison operators Logical operators Operators used to negate conditions
  26. Arithmetic operators + (Addition) Adds values on either side of the operator. a + b will give 30 - (Subtraction) Subtracts right hand operand from left hand operand. a - b will give -10 * (Multiplication) Multiplies values on either side of the operator. a * b will give 200 / (Division) Divides left hand operand by right hand operand. b / a will give 2 % (Modulus) Divides left hand operand by right hand operand and returns remainder. b % a will give 0
  27. Comparison operators = Checks if the values of two operands are equal or not, if yes then condition becomes true. (a = b) is not true. != Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (a != b) is true. <>  Checks if the values of two operands are equal or not, if values are not equal then condition becomes true. (a <> b) is true. >  Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (a > b) is not true. <  Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (a < b) is true. >= Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (a >= b) is not true. <= Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (a <= b) is true. !< Checks if the value of left operand is not less than the value of right operand, if yes then condition becomes true. (a !< b) is false. !> Checks if the value of left operand is not greater than the value of right operand, if yes then condition becomes true. (a !> b) is true.
  28. Logical operators 1 ALL The ALL operator is used to compare a value to all values in another value set. 2 AND The AND operator allows the existence of multiple conditions in an SQL statement's WHERE clause. 3 ANY The ANY operator is used to compare a value to any applicable value in the list as per the condition. 4 BETWEEN The BETWEEN operator is used to search for values that are within a set of values, given the minimum value and the maximum value. 5 EXISTS The EXISTS operator is used to search for the presence of a row in a specified table that meets a certain criterion. 6 IN The IN operator is used to compare a value to a list of literal values that have been specified. 7 LIKE The LIKE operator is used to compare a value to similar values using wildcard operators. 8 NOT The NOT operator reverses the meaning of the logical operator with which it is used. Eg: NOT EXISTS, NOT BETWEEN, NOT IN, etc. This is a negate operator. 9 OR The OR operator is used to combine multiple conditions in an SQL statement's WHERE clause. 10 IS NULL The NULL operator is used to compare a value with a NULL value. 11 UNIQUE The UNIQUE operator searches every row of a specified table for uniqueness (no duplicates).