Structured Query Language
SQL curriculum
SQL curriculum
Preview
These are the chapters that we will approach :
SQL course objectives
Tables used in the course
SQL curriculum
SQL course objectives
After completing this course, you should be able to do
the following:
Identify the major structural components of Oracle
Database 10g
Retrieve row and column data from tables with the
SELECT statement
Create reports of sorted and restricted data
Employ SQL functions to generate and retrieve
customized data
Run data manipulation language (DML) statements to
update data in Oracle Database 10g
Obtain metadata by querying the dictionary views
SQL curriculum
Tables used in the course
Examples of tables used in the course
SQL curriculum
Tables used in the course
The Human Resources (HR) Data Set
Structured Query Language
Introduction to SQL
Introduction to SQL
Preview
These are the chapters that we will approach :
What is RDBMS (SGBDR)?
Possibilities Given by
Oracle
SQL
Introduction to SQL
What is a RDBMS?
Relational
Data
B ase
Management
System
Introduction to SQL
What is a RDBMS?
Relational model and Object relational model
User-defined data types and objects
Fully compatible with relational database
Support of multimedia and large objects
High-quality database server features
Introduction to SQL
What is a RDBMS?
Data storage on Different media
Electronic
Filing cabinet
spreadsheet Database
Introduction to SQL
What is a RDBMS?
Relational database concept
Dr. E. F. Codd proposed the relational model for database
systems in 1970.
It is the basis for the relational database management
system (RDBMS).
The relational model consists of the following:
Collection of objects or relations
Set of operators to act on the relations
Data integrity for accuracy and consistency
Introduction to SQL
What is a RDBMS?
Definition of a relational database
A relational database is a collection of relations or two
dimensional tables
Introduction to SQL
What is a RDBMS?
Data Models
Model of
system in
client’s
mind Entity model of
client’s model
Table model of
entity model
Tables on disk
Introduction to SQL
What is a RDBMS?
Entity Relationship Model
Create an entity relationship diagram from business
specifications :
EMPLOYEE assigned to DEPARTMENT
#* number #* number
* name * name
composed of
o job title o location
Scenario
“...Assign one or more employees to a department...”
“...Some departments do not yet have assigned
employees...”
Introduction to SQL
What is a RDBMS?
Entity relationship modeling conventions
Entity Attribute
Singular, unique name Singular name
Uppercase Lowercase
Soft box Mandatory marked with *
Synonym in parentheses Optional marked with “o”
EMPLOYEE assigned to DEPARTMENT
#* number #* number
* name * name
composed of
o job title o location
Unique identifier (UID)
Primary marked with “#”
Secondary marked with “(#)”
SQL curriculum
Tables used in the course
The Human Resources (HR) Data Set
Introduction to SQL
Possibilities Given by Oracle
Relating Multiple Tables
Each row of data in a table is uniquely identified by a
primary key (PK).
You can logically relate data from multiple tables using
foreign keys (FK).
Primary key Foreign key Primary key
Introduction to SQL
Possibilities Given by Oracle
Relational database terminology
2 3 4
5
6
1
Introduction to SQL
Possibilities Given by Oracle
Relational database Properties
A relational database:
Can be accessed and modified by executing structured
query language (SQL) statements
Contains a collection of tables with no physical pointers
Uses a set of operators
Introduction to SQL
Possibilities Given by Oracle
Communicating with a RDBMS using SQL
SQL statement is entered. Statement is sent to
Oracle server.
SELECT department_name
FROM departments;
Introduction to SQL
Possibilities Given by Oracle
Oracle’s Relational Database Management System
Introduction to SQL
SQL
S tructured
Q uery
L anguage
Introduction to SQL
SQL
SQL -
A computer language designed for the
retrieval and management of data in
relational database management
systems, database schema creation
and modification, and database object
access control management.
Introduction to SQL
SQL
Provides statements for various tasks, including:
Querying data
Inserting, updating, and deleting rows in a table
Creating, replacing, altering, and dropping objects
Controlling access to the database and its objects
Guaranteeing database consistency and integrity
Introduction to SQL
SQL
Type of statements Statements
SELECT
INSERT
Data manipulation language UPDATE
(DML)
DELETE
MERGE
CREATE
ALTER
DROP
Data definition language (DDL)
RENAME
TRUNCATE
COMMENT
GRANT
Data control language (DCL)
REVOKE
COMMIT
Transaction control (TCL) ROLLBACK
SAVEPOINT