SQL 1
SQL 1
SQL 1
SQL
(Structured Query Language)
Oracle Database Management Tools
SQL (sequel) – Structured [English] Query Language
-Standard Language for Managing almost any RDBMS
-Supports with set of commands for managing RDBMS
-Developed by IBM
-Based on Dr. E F Codd’s Relational Model
PL/SQL – Procedural Language/SQL
-Procedural extension to SQL
-Provides with programming language features using which you can
develop application logic programs like procedures, functions, triggers
and packages which will be stored on database server.
Oracle Database Access Tools
SQL*Plus (most widely used tool)
- an interactive tool which takes SQL statements and PL/SQL
programs from you and sends to oracle for execution
- results and errors given by oracle will be presented in default
format or in specific format specified.
-supports many report formatting commands, environment
commands which are useful in presenting data in desired
format, setting the environment, saving statements and
PL/SQL programs in files, spooling etc.,
iSQL*Plus (web browser tool)
SQL*Plus worksheet
SQL command Groups
DQL - Data Query Language
SELECT : used to retrieve the data present in the database tables
DDL - Data Definition Language
CREATE : to create a new data structure.
ALTER : to change an existing data structure.
DROP : to remove an entire data structure.
TRUNCATE : to remove all rows permanently from table
RENAME : to rename existing table
DML - Data Manipulation Language
INSERT : to add records into the table
UPDATE : to change column value in the table
DELETE : to remove rows from the table
MERGE : to update & insert contents of one table to another table
based on condition
DCL - Data Control Language
GRANT :Allow access privileges to users
REVOKE :Revoke or cancel access privileges
TCL-Transaction Control Language.
COMMIT :Save or enable DML changes to the database.
ROLLBACK : To undo DML changes till in a transaction
SAVEPOINT: To divide a transaction
SELECT command query
Input Output
Function
arg 1 Function
performs action
arg 2
Result
value
arg n
Two Types of SQL Functions
Functions
Single-row Multiple-row
functions functions
Character
Accepts Single-row
functions Number
different types
Conversion Date
Character Functions
Character
functions
Case-manipulation Character-manipulation
functions functions
LOWER CONCAT
UPPER SUBSTR
INITCAP LENGTH
INSTR
LPAD | RPAD
LTRIM | RTRIM
REPLACE
TRANSLATE
CHARACTER functions
LOWER (string) – returns data in lower case
UPPER(string) – returns data in upper case
INITCAP(string) – returns with first character in caps for each word
CONCAT(string1,string2) – concatenates two strings
SALES LES ES 0 0
SALESMAN MARKETING
SALESMAN MARKETING
SALESMAN MARKETING
MANAGER MANAGER
SALESMAN MARKETING
CLERK CLERK