2 % ;,
03 4
>
, ,
1
2 0
5,
6 7
89 : <0
%
'
=
?@A?BAC??@
!
"
$
!
"
#
%
#& " '
#
"
( ") * )" +,*-+, " .
),
)% '/
&*0 ". 1 #
! "
&
#
#"
$ $
*
%
"
#
$
% & $
SELE CT% SELE CT
' $
' '()
#
%
$
+
* #
% ' SELE CT% SELE CT
' '() -./!
0 1
,
$
23'.' 4./5&67 3890 14 /. '. 67 20 )3 /21'.8(('
/&)0 /1
SELE CT
+
' '(): -./!
,
;
( SELE CT
'
ALL %
$
' '()8 ' '()<
: -./! ;
; =%: -./!
+,
;
'
% #
' '()0 (
<1
(
,
= -./! (
#
<=%
SELE CT
)
-./!
% FROM #
' '()-./! ( 23'.'-
(
%0 ( %0 (
FROM
#
,
1 > (0
#
%0 (
%
8 +
* +
! !
'+
+
&
+
8
?
68 '
% IN
$
INTO IN
-./! + +
%
$
%$IN
)
+ %
+ +
' '(): -./! ( ' '(): -./! (
0 1 DD<(,@ ! 0 1 D(,@ !
@ 1 @ 1
% %
!
8
,
= D
+ ,
! = -./! ( A+0 1 DD<)'B)C 8)868 '>(,@ ! @ DD )'B)C D -./! ( A+0 1 D(,@
' '(): 0 1)/ (0 ' '(): 0 1)/ (0
(
+ (
(
# IN
% +
%
(
SELE CT
# # % AS %
'
$
' '()1
8
<1
<1
=
1
,
= -./! '
(
# #
% SELE CT #
%
*
SELE CT #
5 % + '
% ALL
$ #
#
!
"
$
!
"
#
DIST INCT
!
% 8 SELE CT%
$ %
&
$
%
# -
%
$ ,
' '() 0 )0 1()<0 (
= -./! -
DIST INCT % & $
*
+ %
& % # $ +
# -
#
#
,
' '() 0 )0 1()0 (
<-
-
= -./! -
'
% DIST INCT $ #
$
.
*
$
%
DIST INCT
8
DIST INCT ROW # %
& ( 0(
* #-
,
' '() 0 )0 1()./2 ( -./! ( 0 11'. ? /0 1/1 (
%1 %0 (
(
%0 ( >-
%0 (
DIST INCT ROW
% DIST INCT ROW $
$ % %
#
$
%
TOP
$ ORDE R BY%
ORDE R BY WHER E% EF
' '())/&EF: -./! -
/. '. 67<)
-
TOP
'
=
#
,
'(
% EE
EF # EE
%
ORDE R BY
PERC ENT%
(
EF
#
#
EF
,
' '())/&EF&'.('1): -./! -
/. '. 67<)
-
=
'(
8 $
%8 %
&
+ #
,
1
+
!
% *
% & ! 8
#
# %
#
$ !
# ' ?
5
0 '!&.'"
G GH " %8 A"
#
% EI 8
' '(): -./! -
$ ! ! 0
9
23'.'<-
6
-
$
JFFK ,
'
H
-
= > ALG EIG FKA
* !
2
M%
'
' '(): -./! -
23'.'<-
7
'
' '(): -./! -
H
-
5
=>
,
9
$
D LG EIG FKD "
+
23'.'<-
-
=>
,
9
D EIG LG FKD "
EI JFFK% (
$
, ALG EIG FKA
ALNEINFKA
AEIG LG JFFKA
E
AEINLNJFFKA
ALG EIG JFFKA
ALNEINJFFKA
AJFFKG LG EIA
AJFFKNLNEIA
AFLG EIG FKA
AFLNEINFKA
AEIG FLG JFFKA
E
AEINFLNJFFKA
AFLG EIG JFFKA
AFLNEINJFFKA
AJFFKG FLG EIA
AJFFKNFLNEIA
E'
$
#
EJC
?
%
9 '
5
$ G G H A AFLG EIG FKA"%
,A
#& WHER E
$ # WHER E
FROM SELE CT%
* + FROM
% #
% )
WHER E
#
JOIN
*
JOIN
WHER E
$ $
WHER E
FROM
*
#
%
, 9
' '(): -./! '
23'.'
>D 9
D
#
' '(): -./! '
(
23'.''
JF#LF H
6')2''1 JF81 LF
+
$ !
?
, AND OR XOR EQV IMP IS #NOT% 8
+
% '
+ ,
O +
EP
O +
JP
+ $
, F
GH
F
CH
9
81
9
81
9
-
-
81
9
-
81
9 -
-
-
9
/.
9
/.
9
9
-
/.
9
9
-
/.
9
B/.
9
B/.
-
B/.
-
B/.
9
' 9
9
' 9
-
' 9
-
' 9
9
0 !&
9
0 !&
9
0 !&
-
0 !&
-
0 !&
-
0
1
0 !&
1
0 !&
1
0 !&
-
9
-
-
9
-
-
9
9
9
-
-
9
9
-
-
9
-
-
9
9
9
-
-
1
1
9
9
-
9
1
9
9
9
-
1
1
1
NOT NOT% IS
'
% '
9
,
O/
P
0
O/
P
8
+ % #
' '(): -./! '
23'.''
JF#LF H
P EI81 '
O LE
,
#
'
' '(): -./! '
23'.' '
P EI81 '
#
O LE" 81
E%FFFFF
,
D81 '
>
P EFFF%FF
,
' '(): -./! '
23'.'1/)'
>D
# !
#
*
D
*
+
EFFF # JFFF
,
' '(): -./! ' D ( D "
23'.'
P III%II81
O JFFF%FE" /. (
>D !
" &
IN
$
-
% %
IN
+ +
0 1
9
<1/)= 0 1
%%%
"
&
!
6
#? * % &
,
' '(): -./! '
23'.'&
0 1 D !
DD 6
DD ?* D "
NOT
IN% ,
' '(): -./! '
'
#
23'.'&
1/)0 1 D !
DD 6
DD ?* D "
" $ BETW EEN
#
+
,
<1/)= 6')2''1
81
' # %
%
C
,
NOT
! 81 0 / 6(
BETW EEN
+
$
?
# %'
#
% 8
*
%
#
' '(): -./! '
23'.''
LF#JF H
6')2''1 LF81 JF
'
' '(): -./! '
23'.' '
#
*
#
E%FFF
6')2''1 JF81 LF" 81
# !
,
*
,
P EFFF%FF
+
EFFF # JFFF
,
' '(): -./! ' D ( D "
23'.'
6')2''1 EFFF%FF81 JFFF%FF" /. (
!
' '(): -./! '
23'.'(
>D !
D81 '
>
,
>0 0 - (&
6')2''1 JQFFF81 JQIII D !
DR "
( LIKE
'
$
+ %
LIKE
+
,
0 S'
!
%
+ %
' !
! ?
?
81 0# LIKE% '
$
81 0#!
$ '
$ /' 6 $
! 81 0 %
$
$ 81 0
$ ? $
!
/' 6
?
!
?
!
8
!
/' 6
!
?
? $ #
? % 81 0 NQI ! ? %8 + 81 0 NIJ !
81 0
0
K%+ #
# !
' K%+
#
% $
? ?
+
?
8/ $ ? K%+ #
! !
?
%
#
E $ /' 6
? %
81 0 % $
%' LIKE
$ #
+
,
2 I
,
8
(
V
(
:
I
*"
;
#
"
U
(
A
(
*
(
" *
'
"
<
"
=
<#
"
=
"
< =" + 81 0 *
A"
$ ? K%+ #
!
/' 6
? % 8
" N"% &
D < N$=D #
8 #T% D < NTFNI=D $
% & #
* %
8NT FNEFF"% D <8NT=D D
< ="
R R " +
NULL% '
IS NULL %
8
+ !
/' 6
?
'
' '(): -./! '
23'.'8
LIKE% 8 / # 8 / %1') # $
' '(): -./! (
23'.'1
'
23'.'1
*
(
0 S'D &<(N!=UD
8
,
0 S'D <8N =UD
$ ,
!,
#
' '(): -./! (
81 0 ,
0 S'D !UD
# ,
#!
$
LIKE
+
, " I *" 9
I 8
DU D
D: D
5
D DD(
D
DD 8
D
DY D
D DD ( D
9
D UD
D :D
D
5
D; D
DV D
D
D<WN$= D
DA D
DF DDE DDJ D
D
5
:"
DD H
D
D
DDL DD6 D
D
D DD
D
D666 D DDEF D
.
D < N$=D
DDDDD ZDD $D
D LDD XDD D
-
D <WN$=D
D IDD YDD UD
DDDDD $DD ID
D <W FNI=D
D 8DDDD YDD UD
D FDD EDD ID
D 8 IDD$FDDIID
D
(
:"
[ <W N =<WN$=D
D<W N =AD
:" 8 8/%
$
$ ? # /' 6
! !
8 /
* ?
$ K%+
# JKJ
"
#
! 6
U XY
( *
*
- 8 @3 ? 81 0 * <WN$=
%
+ *
A" 8
L *
DD FD
+
%"%
") NULL
5
" #
+ "
% %
#
$ 9
NULL 6
% %
&
IS NULL
$ $
+
%
+,
0 <1/)= 15
(
&
,
' '(): -./! (
23'.'( &
0 15
NOT
8H
IS NULL% ' (
' '(): -./! (
* &
23'.'( &
0 1/)15
&
,
FROM % &
$
%
)" +,*-+, " '
),
#
8
$ SELE CT SELE CT%
*
$
% &
$
(
0
%
)" (
%
+
(/51)
,
"
# "% COUN T
+ NULL
+ #
:"
COUN T NULL% 5 $ %
SELE CT
COUN T NULL
+
#
#
NULL% %
Y"% 8
COUN T%
$ ,
' '()(/51) :" 8
<1\ (
'
= -./! (
!
' '()(/51) :" 8
'
<)
,
.
(
= -./! (
&
23'.'(
%'
>D !
D
#
( &
NULL,
' '()(/51) ( &
& ) *
" -./! (
( #(
&
# ,
' '()(/51) :" 8
,*-
<1\ (
= (/51) )
Y( &
" -./! (
, "
(
+
# +
%
,
!0 1 !8B
" "
$ "%
% !
+ +
#
NULL
#
%
8
MAX #MIN%
$ #
' '()!8B 0 (
(
"8
! +0
#
' '()!8B )
"8
,
-./! (
#
! +-
$
!0 1)
"8
! -
,
-./! -
#
' '()!8B -
1 "8
'
?
!0 1-
1 "8
'
,
! #
-./! '
?* ,
' '()!0 1-
0
"8
9
-./! '
23'.'(
>D ?* D
), %
5!
"
# $
%
+
+
$
+ "%
+
#
NULL
% 8
+
$
SUM%
,
,
' '() 5! )
"8
)
-
-./! -
6
0 98 #)
H ,
' '() 5! 6 " 8 ) 6 5! 0 98" 8 ) 6')2''1 AFKG FEG JFFKA 81 AF^G LFG JFFKA
.
0 98
5! 6
]0 98" 8 )
-./! -
23'.'-
)% '/ GROU P BY
*
%' %
' '()
-./!
$
SELE CT +
<23'.'
SUM
= 4./5&67
COUN T # GROU P BY
+ ,
%
NULL +
.
NULL #
#
% WHER E% 5 HAVI NG
+ HAVI NG
$ %
*
WHER E% # 4./5&67
#
SELE CT,
' '()0 (
(
8 H
:" 8
<1\ -
=
5! )
"8
<0
)
= -./! -
4./5&670 (
$ WHER E
$
#
*
,
' '()0 ( (/51) :" 8 <1\ = 5! ) AFKG FEG JFFKA 81 AF^G LFG JFFKA 4./5&670 (
"8
8
<)
-
= -./! -
# %
23'.'-
6')2''1
+
$
$ % &
# E%_FF
,
' '()0 ( (/51) :" 8 <1\ = 5! ) AFEG FEG JFFKA 81 AFLG LEG JFFKA 4./5&670 (
" 8 <) 3890 14 5! )
= -./! " P> E_FF%FF
23'.'-
6')2''1
! !
/
GROU P BY /' #
FROM SELE CT #
%
SELE CT
GROU P BY $
%
&*0 ". HAVI NG
$ +
GROU P BY
' '()
$
#
,
-./!
$
HAVI NG
<23'.'
= 4./5&67
%
3890 14
"
WHER E
>
$ GROU P BY%
# HAVI NG
#
AND # OR%
KF + GROU P BY #HAVI NG%
,
' '()(/51) 0 '
"8
)
(
-./! '
4./5&67(
8
# ,
' '()(/51) 0 '
"8
)
(
-./! '
4./5&67(
3890 14 (
&
>D ?* D
% & -
#'
,
' '()(/51) 0 " 8 <1\ %0 ' >' %0 '
= ' %1 4./5&671
-./! 3890 14 1
0 11'. ? /0 1' >D ' !
1 5
$
$ ORDE R BY
%
$
$ %
ORDE R BY
+
' '(): -./!
'
*
/. '. 67
,
<8 (` ' (= <
(
= <8 (` ' (=
,
/1 $D
' '(): -./! (
/. '. 671
8 (
ASC # TN8 INF" % ( #
ORDE R BY% ' DESC NULL
$ %
'
* % SELE CT C
$
:" FROM% * D 1
' '(): -./! (
D ,
/. '. 67J8 (
(
/. '. 67 , ORDE R BYC
E% J% #
%
'
#
+
% ,
' '()0 (
0-
)
-./! -
/. '. 670 (
ORDE R BY
)
'(
# TOP TOP n PERC ENT ORDE R BY #
SELE CT # # H
#
&
#"
*
%
%
"
WITH OW NERA CCES S O PTIO N # + &'
( )"
$ %
'
#
SELE CT"
# +
SELE CT * INT O"
SELE CT $ INSE RT I NTO"
$ # %
&
#
$ #
# WITH OW NERA CCES S
% (
OPTI ON, '
%
"
!
!
8
! ,
" (
;'
' '(): -./! '
8
20 )3 /21'.8(('
D '
/&)0 /1
D 8 / ,
. %/ . %/
R ( ;' R ' '(): -./! (
*
R ( + ;'
/ S# R ( +
/
Z/ S#
!
( ) Z/
(
)+
!
% (
!
?
WITH OWN ERAC CESS OPT ION%
#
SELE CT #
' %
/ 0
* , 2
I
4 "
)
*, M $
,
2
5,
6 < C??@ ,
#
% 5
+ *
% M
M
%7
Z
#
%