CHAPTER 1
INTRODUCTION TO SQL
EDITORS:
RUZAINI ABULLAH ARSHAH
NURZETY AQTAR AHMAD AZUAN
Faculty of Computer Systems & Software Engineering
ruzaini@ump.edu.my
What is Relational Database?
• A relational database is a collection of tables that
are related to each other
• The concept was introduced by E. F. Codd
(IBM,1970).
• The tables are consist of data items that can be
accessed or reassembled by users using
Structured Query Language (SQL)
• SQL statements used for:
– doing queries to the database
– manipulating data to display reports.
Example of Relational Database
Database
Server
Table name: STAFF Table name: DEPARTMENT
StaffID StaffName Address City DeptID DeptID DeptName
1 Ahmad Razali 24 jln Meriah Kuala Lumpur 20 10 Finance
2 Ana Khamis Lot34, Jn Abiad Johor 10 20 Graphics
3 …
Maria Taque Kg Alur, Alor Gajah Melaka 10 … 30 Software
What is Structured Query Language (SQL)?
• A standard language for relational databases
established by American Standard National
Institute (ANSI®).
• Language use to communicate with Relational
Database to define, retrieve, and manipulate
data in the database tables.
SQL Statements
The followings are list of SQL statements that can be used in ORACLE database:
SELECT
INSERT
UPDATE Data Manipulation Language (DML)
DELETE
MERGE
CREATE
ALTER
DROP Data definition language (DDL)
RENAME
TRUNCATE
COMMENT
GRANT
REVOKE Data control language (DCL)
COMMIT
ROLLBACK
SAVEPOINT Transaction control
Development Environments for SQL in
ORACLE
There are two development environments if you are using
ORACLE product:
• Oracle SQL Developer - (1)
• SQL*Plus - (2)
(1) (2)
The Human Resources (HR) Schema
Source: http://www.databasejournal.com/img/sc_CASETools2_image004.jpg
This database sample is available in Oracle Database software. The software
can be downloaded via Oracle University for educational purpose ONLY
References
Oracle Database 11g: SQL Fundamentals I, Oracle University at:
http://education.oracle.com