Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 SQL Structured Query Language قسم التعريفات Data Definition Language (DDL) قسم التعامل مع البيانات Data Manipulation Language (DML) قسم الاستعلامات Data.

Similar presentations


Presentation on theme: "1 SQL Structured Query Language قسم التعريفات Data Definition Language (DDL) قسم التعامل مع البيانات Data Manipulation Language (DML) قسم الاستعلامات Data."— Presentation transcript:

1 1 SQL Structured Query Language قسم التعريفات Data Definition Language (DDL) قسم التعامل مع البيانات Data Manipulation Language (DML) قسم الاستعلامات Data Control Language (DCL)

2 2 SELECT statement DML (Data Manipulation Language) SELECT * FROM TABLE_NAME * = All Oracle SQL Plus MS SQL Query Analyzer MYSQL

3 3 SELECT statement use northwind Select * from employees  F5 Select Productname, unitprice, supplierID from Products  F5

4 4 SELECT statement العمليات الحسابية Select productname, unitprice*5 from products  F5 Select 2500*4500  F5

5 5 SELECT statement Select ReportsTo from employees  F5 Null value Select isnull(ReportsTo, 0) from employees  F5 Null to 0

6 6 SELECT statement Select ProductName, Unitprice, (UnitPrice*16)Tax from products  F5 Select ProductName, Unitprice, (UnitPrice*16) as Tax from products  F5

7 7 SELECT statement Select FirstName+’ ‘+LastName as name from employees  F5 Select ProductName, Unitprice, (UnitPrice*16) as Tax from products  F5

8 8 SELECT statement where order by select * from Employees order by EmployeeID DESC  F5 select LastName, EmployeeID from Employees order by 2 DESC  F5

9 9 SELECT statement Where filed name = value Select * from Employees where EmployeeID = 8  F5

10 10 SELECT statement Comparison:- X = Y X > Y, X < Y X =Y X <> Y, X != Y, X^=Y

11 11 SELECT statement WHERE…..LIKE Select * from Employees where FirstName like ‘M%’  F5 like ‘M%l’ --- Not like ‘%s’ like ‘M_ _ _ _ _ _’  Micheal

12 12 SELECT statement WHERE …. Between [Value1] AND [Value2] Select * from products where unitprice between 40 and 80  F5

13 13 SELECT statement WHERE ….. IN ([Value1],[Value2], …) Select * from products where unitprice between 40 and 80  F5

14 14 SELECT statement Logic Operators (NOT, OR, AND) Select productName, unitPrice from products where unitPrice >= 25 and productName like ’N%’  F5 Select productName, unitPrice from products where unitPrice >= 25 or productName like ’N%’  F5

15 15 SELECT statement Single Row Functions String Functions :- (lower(x), Upper(x), Len(x), Substring(x,y,[z]), Round(x,y) substring(‘Abcdef’,1,2)  Ab Mathematical Functions:- Abs(n), Mod % – (5%2)  1, Sign(n)  1 if n is positive, -1 if n is negative number, Sqrt(n)

16 16 SELECT statement Single Row Functions Date Function :- dateAdd(datepart, number, date) – dateadd(month, 26,’15-MAR-99’)  15/5/01 Date part (month, day, year, week, hour, minute, second)

17 17 SELECT statement Single Row Functions (Not MS SQL) All kinds of Data :- (characters, Numbers, date) Greatest(x1,x2,x3,….) – Greatest(50, 90, 30)  90 Least(x1,x2,x3,…) – Least(50, 30, 100, 3)  3

18 18 SELECT statement Conversion Function Convert() Convert (Newtype, [Value]) Select unitprice, convert(varchar(8), unitprice) as CharUnit from products


Download ppt "1 SQL Structured Query Language قسم التعريفات Data Definition Language (DDL) قسم التعامل مع البيانات Data Manipulation Language (DML) قسم الاستعلامات Data."

Similar presentations


Ads by Google