Beruflich Dokumente
Kultur Dokumente
Oracle SQL
01.Writing Basic Select Statement
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Chapter01:Writing Basic Select Statement
Introduction
What is Database ? Collection of related data
Employees Departments
Employee number Employee name Department No Department NO Department name Loc
7788 SCOTT 10 10 Accounting Alex
7900 ALEN 20 20 HR Alex
7892 Ward 30 30 Inventory Cairo
8888 Turner 40 40 Purchasing Cairo
What is Table ?
Two dimensional structure consists of rows and columns and used to store data
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Chapter01:Writing Basic Select Statement
Introduction
SQL ( Structure Query Language ) Commands
1.Data retrieval Language ( DRL ) Select writing basic select statement
using oracle single row function
using group functions
joining tables
sub-queries
2. Data Manipulation Language ( DML ) - insert
Update
Delete
Merge
3. Data Definition language (DDL) Create
Alter
Drop , Truncate , Rename …
4. Data Control language ( DCL ) Grant , Revoke , Role , Change Password
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Chapter01:Writing Basic Select Statement
Chapter Content :
Part1 : Writing Basic Select Statement
Writing Basic Select Statement
Using Arithmetic Operators (Writing Expressions)
Using Alias
Using Concatenation
Using Distinct
Part2: Restricting Rows (Using Where Clause )
Using Comparison Operators
Using In Operator
Using Between and Operator
Using Like Operator
Using Not Operator
Using Multiple Conditions
Part3: Sorting Data
Sorting data by one column
Sorting Data By More Than one Column
Using Alias and Column position in Order By Clause
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Chapter01:Writing Basic Select Statement
Chapter Content :
Guide lines
Example :
select *
from emp;
Example :
Desc emp
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
1) ()
2) * /
3) + -
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
1) ()
2) * /
3) - +
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Practices
In Operator
Value list : Search for Group of Values
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Like Operator
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Not
Select *
From emp
Where sal not in ( 800 , 1300 , 3000 ) ;
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Not
Select *
From emp
Where sal not between 2000 and 3000
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Not
Select *
From emp
Where ename not like ‘A%’
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Select *
From emp
Where (deptno = 30 ) and (sal > 2000)
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Select *
From emp
Where (deptno = 30 ) OR (sal > 2000)
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Using Nulls
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Using Nulls
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Introduction to Oracle ERP
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Writing Basic Select St
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list
Arab Academy for Science and Technology and Maritime Transport
College of Computing and Information Technology
AAST : CSP : Oracle Courses : ERP :Oracle Financials
Writing Basic Select St
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list
Sorting Data
Syntax
Select select_list
From table_name
[Where Condition ]
Order by order_by_list