SQL Tutorial - Learn Transact SQL language
Select Distinct Where And - OR Order By Group By Having Like Insert Update Delete
SQL Tutorial
Join Inner Join Left Join Right Join Full Join Union TOP Wildcard IN Between ISNULL
Create database Create table Create index Create view Increment Drop Alter table Add column Alter column Rename column Drop column
Avg Count Max Min Sum Mid Len Round Now UCase LCase
Select
Select Syntax:
SELECT column(s)FROM table ; SELECT * FROM table ;
Store table:
OBJECT_ID PRICE
1
100
2
300
3
800
4
300
Example 1:
SELECT * FROM store;
OBJECT_ID PRICE
1
100
2
300
3
800
4
300
Example 2:
SELECT price FROM store;
PRICE 100 300 800 300
Distinct
Distinct Syntax:
SELECT DISTINCT column_name FROM table_name ;
Store table:
OBJECT_ID PRICE
1
100
2
400
3
800
4
400
Example:
SELECT DISTINCT price FROM store;
PRICE 100 400 800
Where
Where Syntax:
SELECT column_name(s) FROM table_name WHERE condition ;
Store table:
OBJECT_ID PRICE
1
200
2
500
3
900
4
500
Example 1:
SELECT * FROM store WHERE price = 500;
OBJECT_ID PRICE
2
500
4
500
Example 2:
SELECT * FROM store WHERE price > 500;
OBJECT_ID PRICE
3
900
And & OR
Store table:
OBJECT_ID 1 2 3 4
PRICE NAME
200
A
500
B
900
C
500
D
Example 1:
SELECT * FROM store WHERE name='B' AND price = 500;
OBJECT_ID PRICE NAME
2
500
B
Example 2:
SELECT * FROM store WHERE name='B' OR price = 500;
OBJECT_ID PRICE NAME
2
500
B
4
500
D
Example 3:
SELECT * FROM store WHERE price = 900 AND (name='A' OR name='C'); OBJECT_ID PRICE NAME
3
900
C
Order By
Order By Syntax:
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC|DESC
Store table:
OBJECT_ID 1 2 3 4
PRICE NAME
200
A
500
B
900
C
500
D
Example 1:
SELECT * FROM store ORDER BY price, name;
OBJECT_ID 1 2 4 3
PRICE NAME
200
A
500
B
500
D
900
C
Example 2:
SELECT * FROM store ORDER BY name DESC;
OBJECT_ID 4 3 2 1
PRICE NAME
500
D
900
C
500
B
200
A
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- lab 2 data definition language ddl eng alaa o shama
- class notes semester it iv sem subject name dbms
- data base management systems lab manual lendi
- sql tutorial learn transact sql language
- database programming with sql
- guide to using sql synonyms and the rename
- renaming columns and constraints
- oracle 9i streaming the fast information sharing
- ceg computer science dept home
- exercises home yeshiva university
Related searches
- learn english language free download
- java programming language tutorial pdf
- how to learn a new language free
- azure sql managed instance vs sql db
- learn a foreign language free
- how to learn a new language effectively
- learn t sql tutorial
- sql language reference manual pdf
- transact sql rename column
- learn ancient greek language free
- transact sql select top
- transact sql iif