Still using. Windows 3.1? So why stick to SQL-92? Modern SQL in
|
|
- Bruno Willis
- 6 years ago
- Views:
Transcription
1 Still using Windows 3.1? So why stick to SQL-92? Modern SQL in
2 SQL:1999
3 !"#$%"!
4 LATERAL Before SQL:1999 Inline views can't refer to outside the view:!"#"$%&' &&()*+&,- &&.*/0&1!"#"$%&' &&&&&&&&&&()*+&,2 Invalid &&&&&&&&&34")"&,256&7&,-56 &&&&&&&8&9:;9:<=>9<? &&&&*0&19:;9:<=>9<?56&7&,-568
5 LATERAL Before SQL:1999 Inline views can't refer to outside the view:!"#"$%&' &&()*+&,- &&.*/0&1!"#"$%&' &&&&&&&&&&()*+&,2 &&&&&&&&&34")"&,256&7&,-56 &&&&&&&8&9:;9:<=>9<? &&&&*0&19:;9:<=>9<?56&7&,-568 Belongs there
6 LATERAL Since SQL:1999 SQL:99 views can:!"#"$%&' &&()*+&,- &&.*/0&!"#$%"!&1!"#"$%&' &&&&&&&&&&&&&&&&&&()*+&,2 &&&&&&&&&&&&&&&&&34")"&,256&7&,-56 Useless, but still required &&&&&&&&&&&&&&&8&9:;9:<=>9<? &&&&*0&1,AB<8 except for CROSS join Valid due to LATERAL keyword
7 But WHY?
8 LATERAL and Top-N per Group Apply #/+/% per row from previous table:!"#"$%&,cd=dacebf,g5' &&()*+&FH,<ICA9<G&F &&&&&&&&&&&&&&&&&&()*+&DACEBF,G&D &&&&&&&&&&&&&&&&&34")"&D5FH,&7&F5FH, &&&&&&&&&&&&&&&&&'%($%&)*&+,-./0&($12 &&&&&&&&&&&&&&&&&!343#&5 &&&&&&&&&&&&&&&8&,CD=DACEBF,G
9 LATERAL and Multi-Source Top-N Get the 10 most recent news for subscribed topics:!"#"$%&:5' &&()*+&:<?G&: &&.*/0&GBJGFA9D,9C:G&G &&&&*0&1:5,CD9F&7&G5,CD9F8 &34")"&G5BG<A&7&K &*)L")&MN&:5FA<H,<E&L"!$ &#/+/%&-O
10 LATERAL and Multi-Source Top-N!"#"$%&$"#'()*+,-,%./01(2-3 Sort/Reduce 45%6/.$%&$"#'()*+,-,%./01(2-3 %%%6/.$%7'$8/9:%$/;4<%8'=;1/.$%7'#:%*->? C--%./01(D-E -)D3 %%%%%%45%6'F%6G=B%/B%1HI1G.";$"/B1%1 Join everything %%%%%%%%%&$"#'(*+D%./01(C-3 DC+%./01(2-K,3 %%%%%%%%%45%6'F%6G=B%/B%B'01%B %%%%%%%%%%%%&$"#'(D2 )2C%./01(2-K,3 LM=BB"BN%$"#':%-O)DJ%#1 PQ'GH$"/B%$"#':%)*+,-,O)+2%#1
11 LATERAL and Multi-Source Top-N #9P9,&1,9P<72QR SOS&AC?G7-O8 TU&!CA,&1,9P<72QR SOS&AC?G7-O8 Why producing 900k rows... Sort/Reduce &&&!CA,&+<,VCEW&,CDT0&V<HDGCA,&+<PW&QOXM &&&TU&4HGV&.C9:&1,9P<72QQ YOO&AC?G7ZO[ O2Z8 &&&&&&TU&!<\&!FH:&C:&GBJGFA9D,9C:G&G Join everything &&&&&&&&&1,9P<7QRZ&AC?G7YO8 &&&&&&TU&4HGV&1,9P<7-O] ZYR&AC?G7-O^S8 &&&&&&&&&TU&!<\&!FH:&C:&:<?G&:...when there are only 80 subscriptions? &&&&&&&&&&&&1,9P<7Z- 2-Y&AC?G7-O^S8 _;H::9:I&,9P<W&O52Z]&PG "6<FB,9C:&,9P<W&2QR SOS52R-&PG
12 LATERAL and Multi-Source Top-N #9P9,&1,9P<72QR SOS&AC?G7-O8 Only the 10 most Sort/Reduce TU&!CA,&1,9P<72QR SOS&AC?G7-O8 recent per subscription, you need. &&&!CA,&+<,VCEW&,CDT0&V<HDGCA,&+<PW&QOXM &&&TU&4HGV&.C9:&1,9P<72QQ YOO&AC?G7ZO[ O2Z8 &&&&&&TU&!<\&!FH:&C:&GBJGFA9D,9C:G&G Join everything &&&&&&&&&1,9P<7QRZ&AC?G7YO8 &&&&&&TU&4HGV&1,9P<7-O] ZYR&AC?G7-O^S8 &&&&&&&&&TU&!<\&!FH:&C:&:<?G&: &&&&&&&&&&&&1,9P<7Z- 2-Y&AC?G7-O^S8 _;H::9:I&,9P<W&O52Z]&PG "6<FB,9C:&,9P<W&2QR SOS52R-&PG
13 LATERAL and Multi-Source Top-N!"#"$%&:5' &&()*+&GBJGFA9D,9C:G&G &&&&&&&&&&&&&&&&&&()*+&:<?G&: &&&&&&&&&&&&&&&&&34")"&:5,CD9F&7&G5,CD9F &&&&&&&&&&&&&&&&&'%($%&)*&/, &($12 &&&&&&&&&&&&&&&&&!343#&:; &&&&&&&&&&&&&&&8&,CD=:<?G&*0&1,AB<8 &34")"&G5BG<A=9E&7&K &*)L")&MN&:5FA<H,<E&L"!$ &#/+/%&-O
14 LATERAL and Multi-Source Top-N #9P9,&1,9P<725]YY&AC?G7-O8 TU&!CA,&1,9P<725]YS&AC?G7-O8 &&&&&&TU&/:E<6&*:;`&!FH:&BG9:I&DX&C:&G&&& &&&&&&&&&1,9P<7O5O]2&AC?G7YO8 &&&&&&TU	P9, &&&&&&&&&1,9P<7O5O2S&AC?G7-O&;CCDG7YO8 &&&&&&&&&TU&/:E<6&!FH:&MHFX?HAE &&&&&&&&&&&&BG9:I&:<?G=,CD9F=,G=9E&C:&:&& times _;H::9:I&,9P<W&O5-R-&PG "6<FB,9C:&,9P<W&25[-Z&PG Limited to 10 times # of subscriptions About faster
15 LATERAL in an Nutshell is the "for each" loop of SQL plays well with outer joins is an optimization Super-Power handy to join table functions
16 LATERAL Availability (SQL:1999)
17 &'#( (Common Table Expressions)
18 WITH Before SQL:99 Nested queries are hard to read:!"#"$%&a &&()*+&1!"#"$%&a &&&&&&&&&&()*+&,- &&&&&&&&&&.*/0&1!"#"$%&a&()*+&a &&&&&&&&&&&&&&&8&H&*0&1a8 &&&&&&&8&J &&.*/0&1!"#"$%&a&()*+&a &&&&&&&8&F&*0&1a8
19 WITH Before SQL:99 Nested queries are hard to read:!"#"$%&a &&()*+&1!"#"$%&a &&&&&&&&&&()*+&,- &&&&&&&&&&.*/0&1!"#"$%&a&()*+&a Understand this first &&&&&&&&&&&&&&&8&H&*0&1a8 &&&&&&&8&J &&.*/0&1!"#"$%&a&()*+&a &&&&&&&8&F&*0&1a8
20 WITH Before SQL:99 Nested queries are hard to read:!"#"$%&a &&()*+&1!"#"$%&a &&&&&&&&&&()*+&,- Then this... &&&&&&&&&&.*/0&1!"#"$%&a&()*+&a &&&&&&&&&&&&&&&8&H&*0&1a8 &&&&&&&8&J &&.*/0&1!"#"$%&a&()*+&a &&&&&&&8&F&*0&1a8
21 WITH Before SQL:99 Nested queries are hard to read:!"#"$%&a &&()*+&1!"#"$%&a &&&&&&&&&&()*+&,- &&&&&&&&&&.*/0&1!"#"$%&a&()*+&a &&&&&&&&&&&&&&&8&H&*0&1a8 &&&&&&&8&J &&.*/0&1!"#"$%&a&()*+&a Then this... &&&&&&&8&F&*0&1a8
22 WITH Before SQL:99 Nested queries are hard to read:!"#"$%&a Finally the first line makes sense &&()*+&1!"#"$%&a &&&&&&&&&&()*+&,- &&&&&&&&&&.*/0&1!"#"$%&a&()*+&a &&&&&&&&&&&&&&&8&H&*0&1a8 &&&&&&&8&J &&.*/0&1!"#"$%&a&()*+&a &&&&&&&8&F&*0&1a8
23 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
24 WITH Since SQL:99 CTEs are statement-scoped views: Keyword 3/%4 &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
25 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 Name of CTE and (here optional) column names &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
26 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &H&1F-b&F2b&FQ8 &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
27 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &H&1F-b&F2b&FQ8 Introduces another Don't repeat WITH &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
28 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b
29 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &&&&&&()*+&,- May refer to &&&&&&.*/0&H previous CTEs &&&&&&&&*0&1a8 &&&8b
30 3/%4 &H&1F-b&F2b&FQ8 WITH Since &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b Third CTE &&()*+&J&.*/0&F&*0&1a8
31 3/%4 &H&1F-b&F2b&FQ8 WITH Since &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b No comma!!"#"$%&a &&()*+&J&.*/0&F&*0&1a8
32 3/%4 &H&1F-b&F2b&FQ8 WITH Since &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b Main query &&()*+&J&.*/0&F&*0&1a8
33 WITH Since SQL:99 CTEs are statement-scoped views: 3/%4 &&&&&&()*+&,- &&&&&&.*/0&H &&&&&&&&*0&1a8 &&&8b &&()*+&J&.*/0&F&*0&1a8 Read top down
34 WITH in an Nutshell 3/%4 are the "private methods" of SQL 3/%4 views can be referred to multiple times 3/%4 allows chaining instead of nesting 3/%4 is allowed where!"#"$% is allowed /0!")%&/0%*&,J; 3/%4&555&!"#"$%&555
35 WITH PostgreSQL Particularities In PostgreSQL 3/%4 views are more like materialized views: $%"&!FH:&C:&F,< &1AC?G7RQSO8 &(9;,<AW&,CD9F&7&- &$%"&F,< &TU&!<\&!FH:&C:&:<?G &&&&1AC?G7-OOOOOO-8 1!"#"$%&' &&&()*+&:<?G8!"#"$%&'& &&()*+&F,< &34")"&,CD9F7-
36 WITH PostgreSQL Particularities In PostgreSQL 3/%4 views are more like materialized views: $%"&!FH:&C:&F,< &1AC?G7RQSO8 &(9;,<AW&,CD9F&7&- &$%"&F,< &TU&!<\&!FH:&C:&:<?G &&&&1AC?G7-OOOOOO-8 1!"#"$%&' &&&()*+&:<?G8!"#"$%&'& &&()*+&F,< &34")"&,CD9F7-
37 WITH PostgreSQL Particularities CTE In PostgreSQL doesn't 3/%4 views are more like know about the outer filter materialized views: $%"&!FH:&C:&F,< &1AC?G7RQSO8 &(9;,<AW&,CD9F&7&- &$%"&F,< &TU&!<\&!FH:&C:&:<?G &&&&1AC?G7-OOOOOO-8 1!"#"$%&' &&&()*+&:<?G8!"#"$%&'& &&()*+&F,< &34")"&,CD9F7-
38 WITH PostgreSQL Particularities Normal views and inline-views support "predicate pushdown":!"#"$%&' &&()*+&1 &&!"#"$%&' &&&&()*+&:<?G &&8&: M9,PHD&4<HD&!FH: C:&:<?G&1AC?G7RQSO8 TUM9,PHD&/:E<6&!FH: &&C:&9E6&1AC?G7RQSO8 &&$C:EW&,CD9F7-34")"&,CD9F7-c
39 WITH PostgreSQL Particularities PostgreSQL 9.1+ allows /0!")%, and L"#"%" within 3/%4: &&&L"#"%"&()*+&GCBAF< &&&)"%d)0/0e&' 8 /0!")%&/0%*&E<G,9:H,9C:!"#"$%&'&()*+&E<;<,<E=AC?Gc
40 WITH Availability (SQL:99)
41 &'#()%$*+%,'-$ (Common Table Expressions)
42 WITH RECURSIVE Before SQL:99
43 WITH RECURSIVE Before SQL:99 (This page is intentionally left blank)
44 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: Keyword 3/%4&)"$d)!/h"&F,<&1:8 &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c
45 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c Column list mandatory here
46 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 Executed first &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c
47 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 Result sent there &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c
48 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8 Result visible twice!"#"$%&'&()*+&f,<c
49 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8 Once it becomes part of the final result &:& TTT &- &2!"#"$%&'&()*+&F,<c &Q 1Q&AC?G8
50 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c Second leg of UNION is executed &:& TTT &- &2 &Q 1Q&AC?G8
51 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c Result sent there again &:& TTT &- &2 &Q 1Q&AC?G8
52 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&@!&1!"#"$%&- &&&&&&&d0/*0&@## &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c &:& TTT &- &2 &Q 1Q&AC?G8
53 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< It's a loop! &:& TTT &- &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c &2 &Q 1Q&AC?G8
54 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c n=3 doesn't match &:& TTT &- &2 &Q 1Q&AC?G8
55 WITH RECURSIVE Since SQL:99 Recursive common table expressions may refer to themselves in the second leg of a d0/*0&f@##g: 3/%4&)"$d)!/h"&F,<&1:8 &&&&&&&d0/*0&@## &&@!&1!"#"$%&- &&&&&&!"#"$%&:i- &&&&&&&&()*+&F,< &&&&&&&34")"&:&j&Q8!"#"$%&'&()*+&F,<c n=3 doesn't match Loop terminates &:& TTT &- &2 &Q 1Q&AC?G8
56 WITH RECURSIVE Use Cases Row generators (previous example) (I<:<AH,<=G<A9<G18 is proprietary) Processing graphs (don't forget the cycle detection!) Generally said: Loops that pass data to the next iteration... need a "dynamic" abort condition
57 WITH RECURSIVE in a Nutshell 3/%4&)"$d)!/h" is the?v9;< of SQL 3/%4&)"$d)!/h" "supports" infinite loops (not in SQL Server where +@k)"$d)!/*0 is limited to 32767) Except PostgreSQL, databases generally don't require the )"$d)!/h" keyword
58 WITH RECURSIVE Availability
59 SQL:2003
60 !"#$%&
61 FILTER Before SQL:2003 Pivot table: Years on the Y asis, Month on X axis:!"#"$%&'"()*&!"#$%&!'()*'+(#,+-*(.(/ (((((((((-*'+(01230('4!'(5('+67(8&+*!+,-$(!"&./"0&,10%/&2&3 &&&&&&&&&%/"0&45674&"#!"&8&"09:&;"<*= &&;)1,&4567>?5@5 &A)1+B&<'&'"()
62 FILTER Since SQL:2003 SQL:2003 has!"#$%&: '%#%($)*%+&,!"#$%&'(%)*+,-./0*$12/0/*#34.2*5*6)*7849 '-./012304)!"#$%&)/56%&%).78$6)9):4)!%;, < ))!&7.)0123=>1?1
63 FILTER Availability (SQL:2003)
64 .-$% and /"%#'#'.0)12
65 OVER Before SQL:2003 Show percentage of department salary: 3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:, &&&&&&&&()*+&<PD &&&&&&&e)*d_&mn&e<d8!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm &&()*+&<PD &&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G &&&&*0&1<PD5E<D&7&,G5E<D8 &34")"&<PD5E<D&7&K
66 OVER Before SQL:2003 Show percentage of department salary: 3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:, &&&&&&&&()*+&<PD &&&&&&&e)*d_&mn&e<d8!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm &&()*+&<PD &&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G &&&&*0&1<PD5E<D&7&,G5E<D8 &34")"&<PD5E<D&7&K
67 OVER Before SQL:2003 Show percentage of department salary: 3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:, &&&&&&&&()*+&<PD &&&&&&&e)*d_&mn&e<d8!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm &&()*+&<PD &&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G &&&&*0&1<PD5E<D&7&,G5E<D8 &34")"&<PD5E<D&7&K
68 OVER Before SQL:2003 WITH intermezzo Show percentage of department salary: 3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:, &&&&&&&&()*+&<PD &&&&&&&e)*d_&mn&e<d8!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm &&()*+&<PD &&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G &&&&*0&1<PD5E<D&7&,G5E<D8 &34")"&<PD5E<D&7&K
69 OVER Before SQL:2003 Show percentage of department salary: 3/%4&,C,H;=GH;HA`=J`=E<DHA,P<:, &&&&&&&&()*+&<PD &&&&&&&e)*d_&mn&e<d8!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l,G5,C,H;'-OO&mn&Co&E<Dm &&()*+&<PD &&.*/0&,C,H;=GH;HA`=J`=E<DHA,P<:,&,G &&&&*0&1<PD5E<D&7&,G5E<D8 &34")"&<PD5E<D&7&K
70 OVER Before SQL:2003 e)*d_&mn&= L/!%/0$% + Aggregates
71 OVER Since SQL:2003 Build aggregates without e)*d_&mn:!"#"$%&e<db&<pd=9eb&gh;ha`b &&&&&&&GH;HA`l1A4B>.C.-DE &&&&&&&&&&&&&&'F$%BG"%#3#3'H&)*&97+E &&&&&&&&&&&&&'&-OO&mn&Co&E<Dm &&()*+&<PD
72 OVER How It Works E<D GH;HA`!"#"$%&E<Db& &&&&&&&GH;HA`b &&&&&&&!d+1gh;ha`8 &&&&&&&*h")&18 &&()*+&<PDc - -OOO ROOO 22 -OOO ROOO 22 -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO
73 OVER How It Works E<D GH;HA`!"#"$%&E<Db& &&&&&&&GH;HA`b &&&&&&&!d+1gh;ha`8 &&&&&&&*h")&18 &&()*+&<PDc - -OOO ROOO 22 -OOO ROOO 22 -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO
74 OVER How It Works E<D GH;HA`!"#"$%&E<Db& &&&&&&&GH;HA`b &&&&&&&!d+1gh;ha`8 &&&&&&&*h")&18 &&()*+&<PDc - -OOO ROOO 22 -OOO ROOO 22 -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO QQQ -OOO ROOO
75 OVER How It Works E<D GH;HA`,G &E<Db& &GH;HA`b &!d+1gh;ha`8 &<PDc - -OOO -OOO 22 -OOO 2OOO 22 -OOO 2OOO QQQ -OOO QOOO QQQ -OOO QOOO QQQ -OOO QOOO
76 OVER How It Works E<D GH;HA`,G &E<Db& &GH;HA`b &!d+1gh;ha`8 &<PDc - -OOO -OOO 22 -OOO 2OOO 22 -OOO 2OOO QQQ -OOO QOOO QQQ -OOO QOOO QQQ -OOO QOOO
77 OVER How It Works E<D GH;HA`,G &E<Db& &GH;HA`b &!d+1gh;ha`8 &<PDc - -OOO -OOO 22 -OOO 2OOO 22 -OOO 2OOO QQQ -OOO QOOO QQQ -OOO QOOO QQQ -OOO QOOO
78 OVER in a Nutshell *h") may follow any aggregate function *h") defines which rows are visible at each row (it does not limit the result in any way) *h")18 makes all rows visible at every row *h")1_@)%/%/*0&mn x) segregates like e)*d_&mn
79 .-$% and.%3$%)12
80 OVER Before SQL:2003 Calculating a running total:!"#"$%&,69eb&>h;b<b &&&&&&&1!"#"$%&!d+1>H;B<8 &&&&&&&&&&()*+&,AH:GHF,9C:G&,62 &&&&&&&&&34")"&HF:,&7&K &&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
81 OVER Before SQL:2003 Calculating a running total:!"#"$%&,69eb&>h;b<b &&&&&&&1!"#"$%&!d+1>H;B<8 &&&&&&&&&&()*+&,AH:GHF,9C:G&,62 &&&&&&&&&34")"&HF:,&7&K &&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
82 OVER Before SQL:2003 Calculating a running total:!"#"$%&,69eb&>h;b<b &&&&&&&1!"#"$%&!d+1>H;B<8 &&&&&&&&&&()*+&,AH:GHF,9C:G&,62 &&&&&&&&&34")"&HF:,&7&K &&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
83 OVER Before SQL:2003 Calculating a running total:!"#"$%&,69eb&>h;b<b &&&&&&&1!"#"$%&!d+1>H;B<8 &&&&&&&&&&()*+&,AH:GHF,9C:G&,62 &&&&&&&&&34")"&HF:,&7&K &&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
84 OVER Before SQL:2003 Calculating a running total:!"#"$%&,69eb&>h;b<b &&&&&&&1!"#"$%&!d+1>H;B<8 &&&&&&&&&&()*+&,AH:GHF,9C:G&,62 &&&&&&&&&34")"&HF:,&7&K &&&&&&&&&&&@0L&,625,69E&j7&,6-5,69E8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
85 OVER Before SQL:2003 Before SQL:2003 running totals were awkward: Requires a scalar sub-select or self-join Poor maintainability (reparative clauses) Poor performance The only real answer was: Do it in the application
86 OVER Since SQL:2003 With SQL:2003 you can narrow the window:!"#"$%&,69eb&>h;b<b &&&&&&&!d+1>h;b<8 &&&&&&&*h")1'%($%&)*&8ij9 &&&&&&&&&&&&%'K1 &&&&&&&&&&&&)$#K$$H&AH)'AH($(&G%$2$(3HL &&&&&&&&&&&&&&&&"H(&2A%%$H#&%'K8&JH; &&()*+&,AH:GHF,9C:G&,6- &34")"&HF:,&7&K &*)L")&MN&,69E
87 OVER Since SQL:2003 With *h")&1*)l")&mn&a8 a new type of functions makes sense: )*3=0d+M") Ranking functions:& )@0pb&L"0!"=)@0pb&_")$"0%=)@0pb $d+"=l/!%
88 OVER Availability (SQL:2003)
89 !"#$"%&'()*+
90 WITHIN GROUP Before SQL:2003 Getting the median:!"#"$%&'()*+, &&-./0&'+1+&'( &&2/34&'+1+&'5 &&&&/4&6'()*+,&7&'5)*+, &&&&&&&/.&6'()*+,8'5)*+,&94:&'();'7'5);'<< B9C34=&DEFG16H<&8& &&&&&&&6!"#"$%&-#//.6$/>4%6H<I5< &&&&&&&&&&-./0&'+1+<
91 WITHIN GROUP Since SQL:2003 SQL:2003 introduced ordered-set functions... Median!"#"$%&'"($")%*#"+,*!$-./01 &&&&&&&2*%3*)&4(56'&-5(,"(&78&9:;1 &&<(5=&>:?: Which value?...and hypothetical-set functions to say which rank a hypothetical row would have: &!"#"$%&(@)A-BCD1 &&&&&&&&2*%3*)&4(56'&-5(,"(&78&9:;1 &&&<(5=&>:?:
92 WITHIN GROUP Availability
93 SQL:2008
94 .-$%
95 OVER Before SQL:2008 Calculate the difference to a previous row: 3/%4&:BPJ<A<E=EH,H&@!&1 &!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H8&!"#"$%&FBA5'b&FBA5JH;H:F<TDA<>5JH;H:F< &&()*+&&&&&&:BPJ<A<E=EH,H&FBA &&#"(%&.*/0&:BPJ<A<E=EH,H&DA<> &&&&*0&1FBA5A:&7&DA<>5A:T-8
96 OVER Before SQL:2008 Calculate the difference to a previous row: 3/%4&:BPJ<A<E=EH,H&@!&1 &!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H8&!"#"$%&FBA5'b&FBA5JH;H:F<TDA<>5JH;H:F< &&()*+&&&&&&:BPJ<A<E=EH,H&FBA &&#"(%&.*/0&:BPJ<A<E=EH,H&DA<> &&&&*0&1FBA5A:&7&DA<>5A:T-8
97 OVER Since SQL:2008 SQL:2008 can access other rows &&&&&&&&&&&&&&&&&&&&*h")1*)l")&mn&68 &&()*+&EH,H Available functions: Not supported by PostgreSQL (as of 9.4) &&&&&&&&&&&&&&&&&&&)"!_"$%l/e0*)"&0d##!
98 OVER Availability (SQL:2008)
99 4$#*()4'%,#
100 FETCH FIRST Before SQL:2008 Limit the number of selected rows:!"#"$%&' &&()*+&1!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H8&:BPJ<A<E=EH,H &34")"&A:&j7-O
101 FETCH FIRST Before SQL:2008 PostgreSQL Limit the number of selected rows:!"#"$%&' &&()*+&1!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H8&:BPJ<A<E=EH,H &34")"&A:&j7-O does not optimize this properly!
102 FETCH FIRST Before SQL:2008 Limit the number of selected rows:!"#"$%&' &&()*+&1!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H8&:BPJ<A<E=EH,H &34")"&A:&j7-O Dammit! Let's take LIMIT (or TOP)
103 FETCH FIRST Since SQL:2008 SQL:2008 has ("%$4&(/)!%&:&)*3!&*0#N:!"#"$%&' &&()*+&EH,H &*)L")&MN&6 &("%$4&(/)!%&-O&)*3!&*0#N
104 FETCH FIRST Availability
105 SQL:2011
106 .44,$#
107 OFFSET Before SQL:2011 Skip 10 rows, then deliver only the next 10:!"#"$%&' &&()*+&1!"#"$%&'b &&&&&&&&)*3=0d+M")18&*h")1*)L")&MN&68&A: &&&()*+&EH,H &&("%$4&(/)!%&2O&)*3!&*0#N 8&:BPJ<A<E=EH,H &34")"&A:&U&-O
108 OFFSET Since SQL:2011 SQL:2011 introduced *((!"%, unfortunately:!"#"$%&' &&()*+&EH,H &*)L")&MN&6 'MM1$#&:;&%'K1 ("%$4&0"k%&-O&)*3!&*0#N
109 OFFSET is EVIL
110 OFFSET Availability (SQL:2011)
111 &'#(.+#).-$%!"/,
112 WITHOUT OVERLAPS Before SQL:2011 Prior SQL:2011 it was not possible to define constraints that avoid overlapping periods. Workarounds are possible, but no fun: id begin end 1 8:00 9:00 1 9:00 11: :00 12:00
113 WITHOUT OVERLAPS Since SQL:2011 SQL:2011 introduced temporal and bi-temporal features e.g., for constraints: PostgreSQL 9.2 introduced range types and "exclusive constraints" which can accomplish the same effect: "k$#dl"&d!/0e&i9g, &&&&&&&&19E&3/%4&7b&+7-J<9&K3#N&OO8
114 Temporal/Bi-Temporal SQL SQL:2011 goes far beyond Please read these papers to get the idea: Temporal features in SQL: What's new in SQL:2011?
115 WITHOUT OVERLAPS Availability
116 Tuning developers for high SQL performance Training & tuning: Author of: Geeky blog:
Still using. Windows 3.1? So why stick to -
Still using Windows 3.1? So why stick to SQL-92? @ModernSQL - http://modern-sql.com/ @MarkusWinand SQL:1999 LATERAL LATERAL Before SQL:1999 Derived tables (from clause subqueries) cannot see outside: SELECT
More informationModern SQL: Evolution of a dinosaur
Modern SQL: Evolution of a dinosaur Markus Winand Kraków, 9-11 May 2018 Still using Windows 3.1? So why stick with SQL-92? @ModernSQL - https://modern-sql.com/ @MarkusWinand SQL:1999 WITH (Common Table
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL Course: 20761 Course Details Audience(s): IT Professional(s) Technology: Microsoft SQL Server 2016 Duration: 24 HRs. ABOUT THIS COURSE This course is designed to introduce
More informationQuerying Data with Transact-SQL
Course 20761A: Querying Data with Transact-SQL Page 1 of 5 Querying Data with Transact-SQL Course 20761A: 2 days; Instructor-Led Introduction The main purpose of this 2 day instructor led course is to
More informationQuerying Data with Transact-SQL
Course Code: M20761 Vendor: Microsoft Course Overview Duration: 5 RRP: 2,177 Querying Data with Transact-SQL Overview This course is designed to introduce students to Transact-SQL. It is designed in such
More informationQuerying Data with Transact SQL Microsoft Official Curriculum (MOC 20761)
Querying Data with Transact SQL Microsoft Official Curriculum (MOC 20761) Course Length: 3 days Course Delivery: Traditional Classroom Online Live MOC on Demand Course Overview The main purpose of this
More informationQuerying Data with Transact SQL
Course 20761A: Querying Data with Transact SQL Course details Course Outline Module 1: Introduction to Microsoft SQL Server 2016 This module introduces SQL Server, the versions of SQL Server, including
More information"Charting the Course... MOC C: Querying Data with Transact-SQL. Course Summary
Course Summary Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students requiring the knowledge
More informationMicrosoft Querying Data with Transact-SQL - Performance Course
1800 ULEARN (853 276) www.ddls.com.au Microsoft 20761 - Querying Data with Transact-SQL - Performance Course Length 4 days Price $4290.00 (inc GST) Version C Overview This course is designed to introduce
More informationCourse Outline. Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led
Querying Data with Transact-SQL Course 20761B: 5 days Instructor Led About this course This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL 20761B; 5 Days; Instructor-led Course Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can
More informationSql Server Syllabus. Overview
Sql Server Syllabus Overview This SQL Server training teaches developers all the Transact-SQL skills they need to create database objects like Tables, Views, Stored procedures & Functions and triggers
More informationQuerying Microsoft SQL Server 2014
Querying Microsoft SQL Server 2014 Course: 20461 Course Details Audience(s): IT Professional(s) Technology: Microsoft SQL Server 2014 Duration: 40 Hours ABOUT THIS COURSE This forty hours of instructor-led
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL Course 20761C 5 Days Instructor-led, Hands on Course Information The main purpose of the course is to give students a good understanding of the Transact- SQL language which
More information20761 Querying Data with Transact SQL
Course Overview The main purpose of this course is to give students a good understanding of the Transact-SQL language which is used by all SQL Server-related disciplines; namely, Database Administration,
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL Código del curso: 20761 Duración: 5 días Acerca de este curso This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first
More information20461: Querying Microsoft SQL Server 2014 Databases
Course Outline 20461: Querying Microsoft SQL Server 2014 Databases Module 1: Introduction to Microsoft SQL Server 2014 This module introduces the SQL Server platform and major tools. It discusses editions,
More informationQuerying Data with Transact-SQL (20761)
Querying Data with Transact-SQL (20761) Formato do curso: Presencial e Live Training Preço: 1630 Nível: Iniciado Duração: 35 horas The main purpose of this 5 day instructor led course is to give students
More informationQuerying Microsoft SQL Server
Querying Microsoft SQL Server Duration: 5 Days (08:30-16:00) Overview: This course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server. This
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL General Description This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students
More information20761B: QUERYING DATA WITH TRANSACT-SQL
ABOUT THIS COURSE This 5 day course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can be taught as a course to students requiring the knowledge
More informationAfter completing this course, participants will be able to:
Querying SQL Server T h i s f i v e - d a y i n s t r u c t o r - l e d c o u r s e p r o v i d e s p a r t i c i p a n t s w i t h t h e t e c h n i c a l s k i l l s r e q u i r e d t o w r i t e b a
More information20761C: Querying Data with Transact-SQL
20761C: Querying Data with Transact-SQL Course Details Course Code: Duration: Notes: 20761C 5 days This course syllabus should be used to determine whether the course is appropriate for the students, based
More information20461: Querying Microsoft SQL Server
20461: Querying Microsoft SQL Server Length: 5 days Audience: IT Professionals Level: 300 OVERVIEW This 5 day instructor led course provides students with the technical skills required to write basic Transact
More informationQuerying Microsoft SQL Server (MOC 20461C)
Querying Microsoft SQL Server 2012-2014 (MOC 20461C) Course 21461 40 Hours This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for
More informationQuerying Data with Transact-SQL (761)
Querying Data with Transact-SQL (761) Manage data with Transact-SQL Create Transact-SQL SELECT queries Identify proper SELECT query structure, write specific queries to satisfy business requirements, construct
More informationAVANTUS TRAINING PTE LTD
[MS20461]: Querying Microsoft SQL Server 2014 Length : 5 Days Audience(s) : IT Professionals Level : 300 Technology : SQL Server Delivery Method : Instructor-led (Classroom) Course Overview This 5-day
More informationCOURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014
COURSE OUTLINE MOC 20461: QUERYING MICROSOFT SQL SERVER 2014 MODULE 1: INTRODUCTION TO MICROSOFT SQL SERVER 2014 This module introduces the SQL Server platform and major tools. It discusses editions, versions,
More information[AVNICF-MCSASQL2012]: NICF - Microsoft Certified Solutions Associate (MCSA): SQL Server 2012
[AVNICF-MCSASQL2012]: NICF - Microsoft Certified Solutions Associate (MCSA): SQL Server 2012 Length Delivery Method : 5 Days : Instructor-led (Classroom) Course Overview Participants will learn technical
More informationQuerying Microsoft SQL Server
Querying Microsoft SQL Server 20461D; 5 days, Instructor-led Course Description This 5-day instructor led course provides students with the technical skills required to write basic Transact SQL queries
More informationCOURSE OUTLINE: Querying Microsoft SQL Server
Course Name 20461 Querying Microsoft SQL Server Course Duration 5 Days Course Structure Instructor-Led (Classroom) Course Overview This 5-day instructor led course provides students with the technical
More informationQuerying Data with Transact-SQL
Querying Data with Transact-SQL Duration: 5 Days Course Code: M20761 Overview: This course is designed to introduce students to Transact-SQL. It is designed in such a way that the first three days can
More informationQuerying Microsoft SQL Server
Querying Microsoft SQL Server Course 20461D 5 Days Instructor-led, Hands-on Course Description This 5-day instructor led course is designed for customers who are interested in learning SQL Server 2012,
More informationDuration Level Technology Delivery Method Training Credits. Classroom ILT 5 Days Intermediate SQL Server
NE-20761C Querying with Transact-SQL Summary Duration Level Technology Delivery Method Training Credits Classroom ILT 5 Days Intermediate SQL Virtual ILT On Demand SATV Introduction This course is designed
More information"Charting the Course to Your Success!" MOC D Querying Microsoft SQL Server Course Summary
Course Summary Description This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2014. This course is the foundation
More informationMicrosoft Querying Microsoft SQL Server 2014
1800 ULEARN (853 276) www.ddls.com.au Microsoft 20461 - Querying Microsoft SQL Server 2014 Length 5 days Price $4290.00 (inc GST) Version D Overview Please note: Microsoft have released a new course which
More information$99.95 per user. Writing Queries for SQL Server (2005/2008 Edition) CourseId: 160 Skill level: Run Time: 42+ hours (209 videos)
Course Description This course is a comprehensive query writing course for Microsoft SQL Server versions 2005, 2008, and 2008 R2. If you struggle with knowing the difference between an INNER and an OUTER
More informationQUERYING MICROSOFT SQL SERVER COURSE OUTLINE. Course: 20461C; Duration: 5 Days; Instructor-led
CENTER OF KNOWLEDGE, PATH TO SUCCESS Website: QUERYING MICROSOFT SQL SERVER Course: 20461C; Duration: 5 Days; Instructor-led WHAT YOU WILL LEARN This 5-day instructor led course provides students with
More informationCourse 20461C: Querying Microsoft SQL Server
Course 20461C: Querying Microsoft SQL Server Audience Profile About this Course This course is the foundation for all SQL Serverrelated disciplines; namely, Database Administration, Database Development
More informationQuerying Microsoft SQL Server 2012/2014
Page 1 of 14 Overview This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL queries for Microsoft SQL Server 2014. This course is the foundation
More informationQuerying Microsoft SQL Server 2008/2012
Querying Microsoft SQL Server 2008/2012 Course 10774A 5 Days Instructor-led, Hands-on Introduction This 5-day instructor led course provides students with the technical skills required to write basic Transact-SQL
More information20461D: Querying Microsoft SQL Server
20461D: Querying Microsoft SQL Server Course Details Course Code: Duration: Notes: 20461D 5 days This course syllabus should be used to determine whether the course is appropriate for the students, based
More informationMicrosoft - Querying Microsoft SQL Server 2014 (M20461) (M20461)
Microsoft - Querying Microsoft SQL Server 2014 (M20461) (M20461) Code: 6552 Lengt h: URL: 5 days View Online In this course, you will learn the technical skills required to write basic Transact-SQL (T-SQL)
More informationCourse Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course:
Course Modules for MCSA: SQL Server 2016 Database Development Training & Certification Course: 20762C Developing SQL 2016 Databases Module 1: An Introduction to Database Development Introduction to the
More informationQuerying Data with Transact-SQL
Course Outline 20761- Querying Data with Transact-SQL Duration: 5 days (30 hours) Target Audience: This course is the intended for Database Administrators, Database Developers, and Business Intelligence
More informationQuerying Microsoft SQL Server
20461 - Querying Microsoft SQL Server Duration: 5 Days Course Price: $2,975 Software Assurance Eligible Course Description About this course This 5-day instructor led course provides students with the
More informationMANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 6 Professional Program: Data Administration and Management MANAGING DATA(BASES) USING SQL (NON-PROCEDURAL SQL, X401.9) AGENDA
More informationQuerying Microsoft SQL Server 2014
Querying Microsoft SQL Server 2014 Código del curso: 20461 Duración: 5 días Acerca de este curso This 5 day instructor led course provides students with the technical skills required to write basic Transact
More informationMS_20761 Querying Data with Transact-SQL
Querying Data with Transact-SQL www.ked.com.mx Av. Revolución No. 374 Col. San Pedro de los Pinos, C.P. 03800, México, CDMX. Tel/Fax: 52785560 Por favor no imprimas este documento si no es necesario. About
More informationWriting Your First Common Table Expression with SQL Server
Writing Your First Common Table Expression with SQL Server Day 2 of Common Table Expression Month (June) at SteveStedman.com, today I will cover creating your very first CTE. Keep in mind that this may
More informationMCSA SQL SERVER 2012
MCSA SQL SERVER 2012 1. Course 10774A: Querying Microsoft SQL Server 2012 Course Outline Module 1: Introduction to Microsoft SQL Server 2012 Introducing Microsoft SQL Server 2012 Getting Started with SQL
More informationQuerying Microsoft SQL Server
Course Code: M20461 Vendor: Microsoft Course Overview Duration: 5 RRP: POA Querying Microsoft SQL Server Overview This 5-day instructor led course provides delegates with the technical skills required
More informationCourse 20461C: Querying Microsoft SQL Server
Course 20461C: Querying Microsoft SQL Server About this course: This course is the foundation for all SQL Server related disciplines; namely, Database Administration, Database development and business
More informationSQL Data Query Language
SQL Data Query Language André Restivo 1 / 68 Index Introduction Selecting Data Choosing Columns Filtering Rows Set Operators Joining Tables Aggregating Data Sorting Rows Limiting Data Text Operators Nested
More informationCompare Two Identical Tables Data In Different Oracle Databases
Compare Two Identical Tables Data In Different Oracle Databases Suppose I have two tables, t1 and t2 which are identical in layout but which may You may try dbforge Data Compare for Oracle, a **free GUI
More informationMySQL 8.0: Common Table Expressions
MySQL 8.0: Common Table Expressions Guilhem Bichot Lead Software Engineer MySQL Optimizer Team, Oracle Who With MySQL AB / Sun / Oracle since 2002 Coder on the Server from 4.0 to 8.0 Replication, on-line
More informationMIS NETWORK ADMINISTRATOR PROGRAM
NH107-7475 SQL: Querying and Administering SQL Server 2012-2014 136 Total Hours 97 Theory Hours 39 Lab Hours COURSE TITLE: SQL: Querying and Administering SQL Server 2012-2014 PREREQUISITE: Before attending
More informationTopics. CSCI 403 Database Management DISTINCT. JOIN Clause 2/4/2019 DISTINCT JOINS. 12 Miscellaneous Topics
Topics CSCI 403 Database Management 12 Miscellaneous Topics This lecture is for stuff I forgot or didn t have time to cover so far Miscellaneous SELECT DISTINCT JOIN clause and outer joins SET operations
More informationSQL Recursion, Window Queries
SQL Recursion, Window Queries FCDB 10.2 Dr. Chris Mayfield Department of Computer Science James Madison University Apr 02, 2018 Tips on GP5 Java Create object(s) to represent query results Use ArrayList
More informationQuerying Microsoft SQL Server (461)
Querying Microsoft SQL Server 2012-2014 (461) Create database objects Create and alter tables using T-SQL syntax (simple statements) Create tables without using the built in tools; ALTER; DROP; ALTER COLUMN;
More informationWhat is Meant By Cotton Goods
/ 6 9 - z 9 / 9 q - ; x - 6 \ ~ 9? - -» z z - x - - / - 9 -» ( - - - ( 9 x q ( -x- ( ]7 q -? x x q - 9 z X _? & & - ) - ; - 96? - - ; - / 99 - - - - x - - 9 & \ x - z ; - - x - - 6 q - z z ; 9 x 9 - -
More informationSQL Recursion, Window Queries
SQL Recursion, Window Queries PG 7.8; 3.5 & 9.21 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 20, 2019 WITH clause Basic syntax: WITH R AS
More informationTopics. Introduction to Repetition Structures Often have to write code that performs the same task multiple times. Controlled Loop
Topics C H A P T E R 4 Repetition Structures Introduction to Repetition Structures The for Loop: a Count- Sentinels Nested Loops Introduction to Repetition Structures Often have to write code that performs
More informationQuerying Microsoft SQL Server 2014
Querying Microsoft SQL Server 2014 Referencia MOC 20461 Duración (horas) 25 Última actualización 27 marzo 2018 Modalidades Presencial, a medida Examen 70-461 Introducción This 5-day instructor led course
More informationQuerying Data with Transact-SQL
20761 - Querying Data with Transact-SQL Duration: 5 Days Course Price: $2,975 Software Assurance Eligible Course Description About this course This course is designed to introduce students to Transact-SQL.
More informationHP NonStop Structured Query Language (SQL)
HP HP0-780 NonStop Structured Query Language (SQL) http://killexams.com/exam-detail/hp0-780 B. EXEC SQL UPDATE testtab SET salary = 0; C. EXEC SQL UPDATE testtab SET salary = :-1; D. EXEC SQL UPDATE testtab
More informationAdvance Database Systems. Joining Concepts in Advanced SQL Lecture# 4
Advance Database Systems Joining Concepts in Advanced SQL Lecture# 4 Lecture 4: Joining Concepts in Advanced SQL Join Cross Join Inner Join Outer Join 3 Join 4 Join A SQL join clause combines records from
More informationVenezuela: Teléfonos: / Colombia: Teléfonos:
CONTENIDO PROGRAMÁTICO Moc 20761: Querying Data with Transact SQL Module 1: Introduction to Microsoft SQL Server This module introduces SQL Server, the versions of SQL Server, including cloud versions,
More informationSubquery: There are basically three types of subqueries are:
Subquery: It is also known as Nested query. Sub queries are queries nested inside other queries, marked off with parentheses, and sometimes referred to as "inner" queries within "outer" queries. Subquery
More informationPerformance Enhancements In PostgreSQL 8.4
Performance Enhancements In PostgreSQL 8.4 PGDay.EU 2009 Paris, France Magnus Hagander Redpill Linpro AB PostgreSQL 8.4 Released July 2009 8.4.1 released September 2009 Major upgrade from 8.3 New features
More informationImprove the Performance of Your T-SQL by Changing Your Habits. Mickey Stuewe Microsoft Junkie Sr Database Developer
Improve the Performance of Your T-SQL by Changing Your Habits Mickey Stuewe Microsoft Junkie Sr Database Developer Your Background DBA Database Developer Programmer Manager Just Checking Things Out 2 Objectives
More informationMySQL for Developers with Developer Techniques Accelerated
Oracle University Contact Us: 02 696 8000 MySQL for Developers with Developer Techniques Accelerated Duration: 5 Days What you will learn This MySQL for Developers with Developer Techniques Accelerated
More informationSQL Let s Join Together
Schaumburg SQL Let s Join Together Birgitta Hauser bha@toolmaker.de / Hauser@SSS-Software.de TOOLMAKER Advanced Efficiency GmbH Tel. (+49) 08191 968-0 www.toolmaker.de Landsberg am Lech - Bayertor Seite
More informationPostgreSQL Query Optimization. Step by step techniques. Ilya Kosmodemiansky
PostgreSQL Query Optimization Step by step techniques Ilya Kosmodemiansky (ik@) Agenda 2 1. What is a slow query? 2. How to chose queries to optimize? 3. What is a query plan? 4. Optimization tools 5.
More informationOracle Database: SQL and PL/SQL Fundamentals Ed 2
Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Oracle Database: SQL and PL/SQL Fundamentals Ed 2 Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals
More informationA Second Look At ML. Chapter Seven Modern Programming Languages, 2nd ed. 1
A Second Look At ML Chapter Seven Modern Programming Languages, 2nd ed. 1 Outline Patterns Local variable definitions A sorting example Chapter Seven Modern Programming Languages, 2nd ed. 2 Two Patterns
More informationQuery To Find Table Name Using Column Name In Sql Server
Query To Find Table Name Using Column Name In Sql Server Is there a PostgreSQL query or command that returns the field names and field types of a query, table or view? E.g., a solution if applied to simple
More informationPerformance Optimization for Informatica Data Services ( Hotfix 3)
Performance Optimization for Informatica Data Services (9.5.0-9.6.1 Hotfix 3) 1993-2015 Informatica Corporation. No part of this document may be reproduced or transmitted in any form, by any means (electronic,
More informationAO3 - Version: 2. Oracle Database 11g SQL
AO3 - Version: 2 Oracle Database 11g SQL Oracle Database 11g SQL AO3 - Version: 2 3 days Course Description: This course provides the essential SQL skills that allow developers to write queries against
More informationPartitioning Shines in PostgreSQL 11
Partitioning Shines in PostgreSQL 11 Amit Langote, NTT OSS Center PGConf.ASIA, Tokyo Dec 11, 2018 About me Amit Langote Work at NTT OSS Center developing PostgreSQL Contributed mainly to table partitioning
More informationPagination Done the PostgreSQL Way
Pagination Done the PostgreSQL Way istockphoto/mitshu 2013 by Markus Winand About Me = 2013 by Markus Winand Note In this presentation index means B-tree index. 2013 by Markus Winand A Trivial Example
More informationSQL Query Writing Tips To Improve Performance in Db2 and Db2 Warehouse on Cloud
SQL Query Writing Tips To Improve Performance in Db2 and Db2 Warehouse on Cloud Calisto Zuzarte IBM St. Louis Db2 User s Group 201803 Tue, March 06, 2018 Db2 Warehouse Db2 Warehouse on Cloud Integrated
More informationOracle Database: Introduction to SQL Ed 2
Oracle University Contact Us: +40 21 3678820 Oracle Database: Introduction to SQL Ed 2 Duration: 5 Days What you will learn This Oracle Database 12c: Introduction to SQL training helps you write subqueries,
More informationDB2 UDB: Application Programming
A ABS or ABSVAL... 4:19 Access Path - Determining... 10:8 Access Strategies... 9:3 Additional Facts About Data Types... 5:18 Aliases... 1:13 ALL, ANY, SOME Operator... 3:21 AND... 3:12 Arithmetic Expressions...
More informationOracle Database 11g: SQL and PL/SQL Fundamentals
Oracle University Contact Us: +33 (0) 1 57 60 20 81 Oracle Database 11g: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn In this course, students learn the fundamentals of SQL and PL/SQL
More informationOracle Syllabus Course code-r10605 SQL
Oracle Syllabus Course code-r10605 SQL Writing Basic SQL SELECT Statements Basic SELECT Statement Selecting All Columns Selecting Specific Columns Writing SQL Statements Column Heading Defaults Arithmetic
More informationOVERVIEW OF RELATIONAL DATABASES: KEYS
OVERVIEW OF RELATIONAL DATABASES: KEYS Keys (typically called ID s in the Sierra Database) come in two varieties, and they define the relationship between tables. Primary Key Foreign Key OVERVIEW OF DATABASE
More informationAdvanced SQL Processing Prepared by Destiny Corporation
Advanced SQL Processing Prepared by Destiny Corporation Summary Functions With a single argument, but with other selected columns, the function gives a result for all the rows, then merges the back with
More informationSQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances
COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general
More informationCMP-3440 Database Systems
CMP-3440 Database Systems Relational DB Languages Relational Algebra, Calculus, SQL Lecture 05 zain 1 Introduction Relational algebra & relational calculus are formal languages associated with the relational
More informationAuthentication via Active Directory and LDAP
Authentication via Active Directory and LDAP Overview The LDAP and Active Directory authenticators available in Datameer provide remote authentication services for Datameer users. Administrators can configure
More informationThe Mother of All Query Languages: SQL in Modern Times
The Mother of All Query Languages: SQL in Modern Times @MarkusWinand @ModernSQL http://www.almaden.ibm.com/cs/people/chamberlin/sequel-1974.pdf 1974 1992 SQL-92 Tied to the Relational Idea Relational Data
More information3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key
Unit 3: Types of Keys & Data Integrity 3.1. Keys: Super Key, Candidate Key, Primary Key, Alternate Key, Foreign Key Different Types of SQL Keys A key is a single or combination of multiple fields in a
More informationUsing Stored Queries Instead of Nested Queries in the FROM Clause
Chapter 9 Advanced Query Formulation with SQL 389 APPENDIX 9.A: USAGE OF MULTIPLE STATEMENTS IN MICROSOFT ACCESS In Microsoft Access, you can use multiple SELECT statements instead of nested queries in
More informationTop 5 Issues that Cannot be Resolved by DBAs (other than missed bind variables)
Top 5 Issues that Cannot be Resolved by DBAs (other than missed bind variables) March 12, 2013 Michael Rosenblum Dulcian, Inc. www.dulcian.com 1 of 43 Who Am I? Misha Oracle ACE Co-author of 2 books PL/SQL
More informationORACLE TRAINING CURRICULUM. Relational Databases and Relational Database Management Systems
ORACLE TRAINING CURRICULUM Relational Database Fundamentals Overview of Relational Database Concepts Relational Databases and Relational Database Management Systems Normalization Oracle Introduction to
More informationASSIGNMENT NO Computer System with Open Source Operating System. 2. Mysql
ASSIGNMENT NO. 3 Title: Design at least 10 SQL queries for suitable database application using SQL DML statements: Insert, Select, Update, Delete with operators, functions, and set operator. Requirements:
More informationADVANTAGES. Via PL/SQL, all sorts of calculations can be done quickly and efficiently without use of Oracle engine.
1 PL/SQL INTRODUCTION SQL does not have procedural capabilities. SQL does not provide the programming techniques of condition checking, looping and branching that is required for data before permanent
More informationRule 1-3: Use white space to break a function into paragraphs. Rule 1-5: Avoid very long statements. Use multiple shorter statements instead.
Chapter 9: Rules Chapter 1:Style and Program Organization Rule 1-1: Organize programs for readability, just as you would expect an author to organize a book. Rule 1-2: Divide each module up into a public
More information5. Single-row function
1. 2. Introduction Oracle 11g Oracle 11g Application Server Oracle database Relational and Object Relational Database Management system Oracle internet platform System Development Life cycle 3. Writing
More information