Syntax:
Select * | {Distinct} column | expression [alias] ,... } from table;
Select all Columns : Select * from table_name;
Selecting particular column: Select column1,column2 from table_name;
Examples:
Select last_name,salary+300 from table_name
Select last_name, 12*salary+300 from table_name
Select last_name,12*(salary+100) from table_name
Arthritic Expression
Select last_name as name from table_name (alias)
Select last_name “Name” from table_name
Concatitation:
Select first_name||last_name from table_name
Select last_name||'is a'|| salary from table_name (literal)
Select last_name || q'[, it's a manager_id]' from table_name
Distinct: Unique
Select distinct(last_name) from table_name
SQL comparison Operators
|
=
|
Equal (a = b )
|
|
!= or <>
|
Not Equal ( a != b)
|
|
<
|
Less than
|
|
>
|
Greater than
|
|
<=
|
Less than equal to
|
|
>=
|
Greater than equal to
|
|
any
|
Compares one value with any value in list
|
|
all
|
Compares one value
with all values in list
|
|
like
|
Matches
patterns in strings. _ single character , % multiple
|
|
in
|
Matches lists of values
|
|
between
|
Matches range of values
|
|
Is null
|
Matches null values
|
|
Is nan
|
Matches nan
special value, not number
|
|
Is infinite
|
Matches binary float and binary
infinite
|
|
and
|
Returns true when x and y are true
|
|
or
|
Returns true when either x or y is
true
|
|
Not x
|
Return true if x is false , returns
false if x is true
|

No comments:
Post a Comment