SlideShare a Scribd company logo
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

PPT
The Database Environment and Development Process
PPTX
The Database Environment and Development Process
PPTX
Modeling Data in the Organization
PPTX
PPT
Enhanced E-R Model
PPT
Logical DB Design and Relational Model
PPT
Modeling Data in the Organization
The Database Environment and Development Process
The Database Environment and Development Process
Modeling Data in the Organization
Enhanced E-R Model
Logical DB Design and Relational Model
Modeling Data in the Organization

What's hot (12)

PPTX
Supporting Transactions
PDF
Supporting search as-you-type using sql in databases
PPTX
Search as-you-type (Exact search)
PPTX
Database Management System
DOCX
JPJ1422 Fast Nearest Neighbour Search With Keywords
DOCX
Fast nearest neighbor search with keywords
DOCX
fast nearest neighbor search with keywords
PDF
LinkedIn Resume
PPTX
What are Data Models?
PPTX
DBMS-Quick Reference
Supporting Transactions
Supporting search as-you-type using sql in databases
Search as-you-type (Exact search)
Database Management System
JPJ1422 Fast Nearest Neighbour Search With Keywords
Fast nearest neighbor search with keywords
fast nearest neighbor search with keywords
LinkedIn Resume
What are Data Models?
DBMS-Quick Reference
Ad

Similar to Introduction to SQL (20)

PPTX
RDBMS
PPT
Normalization
PPT
D B M S Animate
PDF
SQL Complete Tutorial. All Topics Covered
PPT
Ardbms
PPTX
chapter_2_-_midterm__aik__daatabase.pptx
PPTX
BASIC_OF_DATABASE_PPT__new[1].pptx
PPTX
PPTX
DBMS Part-3.pptx
PDF
International Journal of Engineering Research and Development
PPTX
RDMS AND SQL
PDF
DBMS unit-3.pdf
PDF
Dbms fundamentals
PPT
week3.ppt
PPT
DB Design.ppt
PDF
Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014
PPT
Dbms relational model
PDF
Unit 3 rdbms study_materials-converted
PPTX
Lecture 2 sql {basics date type, constrains , integrity types etc.}
RDBMS
Normalization
D B M S Animate
SQL Complete Tutorial. All Topics Covered
Ardbms
chapter_2_-_midterm__aik__daatabase.pptx
BASIC_OF_DATABASE_PPT__new[1].pptx
DBMS Part-3.pptx
International Journal of Engineering Research and Development
RDMS AND SQL
DBMS unit-3.pdf
Dbms fundamentals
week3.ppt
DB Design.ppt
Data Wrangling in SQL & Other Tools :: Data Wranglers DC :: June 4, 2014
Dbms relational model
Unit 3 rdbms study_materials-converted
Lecture 2 sql {basics date type, constrains , integrity types etc.}
Ad

More from Dr. Rosemarie Sibbaluca-Guirre (20)

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

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Complications of Minimal Access Surgery at WLH
PDF
Sports Quiz easy sports quiz sports quiz
PDF
Pre independence Education in Inndia.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
Institutional Correction lecture only . . .
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Cell Structure & Organelles in detailed.
PDF
01-Introduction-to-Information-Management.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Insiders guide to clinical Medicine.pdf
Microbial diseases, their pathogenesis and prophylaxis
Renaissance Architecture: A Journey from Faith to Humanism
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Complications of Minimal Access Surgery at WLH
Sports Quiz easy sports quiz sports quiz
Pre independence Education in Inndia.pdf
Classroom Observation Tools for Teachers
Institutional Correction lecture only . . .
human mycosis Human fungal infections are called human mycosis..pptx
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Anesthesia in Laparoscopic Surgery in India
Cell Structure & Organelles in detailed.
01-Introduction-to-Information-Management.pdf
Supply Chain Operations Speaking Notes -ICLT Program
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx

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

  • #6: 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.
  • #7: 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
  • #8: 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
  • #9: 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.
  • #10: 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.
  • #12: 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 −
  • #16: 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.
  • #17: 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 −
  • #18: 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 −
  • #22: 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.
  • #23: 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.
  • #24: 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.
  • #25: 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.
  • #26: Following are some of the most commonly used constraints available in SQL − INDEX − Used to create and retrieve data from the database very quickly.
  • #27: Following are some of the most commonly used constraints available in SQL − INDEX − Used to create and retrieve data from the database very quickly.
  • #28: 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.
  • #29: 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.
  • #30: 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)
  • #31: 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.
  • #32: 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.
  • #33: Note − Here, datetime has 3.33 milliseconds accuracy where as smalldatetime has 1 minute accuracy.
  • #34: 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)
  • #35: 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
  • #36: 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
  • #37: Arithmetic operators Comparison operators Logical operators Operators used to negate conditions
  • #38: 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
  • #39: 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.
  • #40: 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).