SlideShare a Scribd company logo
1 of 37
Oracle Tips & Tricks  Feb 10, 2011 Shane Zhang
AGENDA ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CASE Statement vs. Decode  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ANSI Standard Join Syntax ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Join Operators ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Join Operators Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object]
New in 9i - Full Outer Joins ,[object Object],[object Object],[object Object],[object Object],[object Object]
Self Joins ,[object Object],[object Object],[object Object],[object Object]
Renaming – Columns, Constraints, Tables ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Top N Analysis ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Windowing Function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Traverse the Hierarchical tree ,[object Object],[object Object],[object Object],[object Object],[object Object],Does JONES have any authority over BLAKE?“ SELECT *  FROM employee WHERE lname = 'BLAKE' START WITH lname = 'JONES' CONNECT BY manager_emp_id = PRIOR emp_id;
XML ,[object Object],[object Object],[object Object],[object Object]
Using subquery ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using subquery – Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
With Clause ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Having Clause ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Oracle 9i – TIMESTAMP Data Type ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Information of a table ,[object Object],[object Object],[object Object],[object Object]
Information on Space ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Group By Enhancements – Grouping Set select count(*) CNT, deptno, 'summary' as job from emp group by deptno UNION ALL select count(*), deptno, job from emp group by deptno, job / CNT  DEPTNO JOB --- ---------- --------- 3  10 Summary 1  10 PRESIDENT 1  10 MANAGER 1  10 CLERK 5  20 Summary 1  20 MANAGER 2  20 CLERK 2  20 ANALYST 6  30 Summary 4  30 SALESMAN 1  30 MANAGER 1  30 CLERK select count(*) CNT, deptno , CASE GROUPING_ID(job) WHEN 1 THEN 'Summary' ELSE job END AS job from emp group by GROUPING SETS ( (deptno) , (deptno, job ) ) / CNT  DEPTNO JOB --- ---------- --------- 3  10 Summary 1  10 PRESIDENT 1  10 MANAGER 1  10 CLERK 5  20 Summary 1  20 MANAGER 2  20 CLERK 2  20 ANALYST 6  30 Summary 4  30 SALESMAN 1  30 MANAGER 1  30 CLERK Union all method,  multiple table scan , slow New method, fast
Group By Enhancements – ROLLUP / CUBE ,[object Object],[object Object],[object Object]
ROLLUP Example Query ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ROLLUP Example Output SHP_RCV_SRC_CD TNDR_TYPE_CD SUM(A.NBR_OF_PKGS) SUM(A.NET_REV) SUM(A.RATD_WGT) 3 CCC 15204 452297 76297 3 DRPF 688169 12653173 3509281 3 SOLD 570572 8422926 3112950 3 ? 1273945 21528396 6698529 4 CCC 26 1414 100 4 DRPF 484 28301 4350 4 SOLD 759 23706 5306 4 ? 1269 53421 9756 5 CCC 18 975 80 5 DRPF 2123 101847 12510 5 SOLD 230 7026 1625 5 ? 2371 109849 14215 ? ? 1277585 21691666 6722500
CUBE Example Query  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
CUBE Example Output SHP_RCV_SRC_CD TNDR_TYPE_CD SUM(A.NBR_OF_PKGS) SUM(A.NET_REV) SUM(A.RATD_WGT) 3 CCC 15204 452297 76297 3 DRPF 688169 12653173 3509281 3 SOLD 570572 8422926 3112950 3 ? 1273945 21528396 6698529 4 CCC 26 1414 100 4 DRPF 484 28301 4350 4 SOLD 759 23706 5306 4 ? 1269 53421 9756 5 CCC 18 975 80 5 DRPF 2123 101847 12510 5 SOLD 230 7026 1625 5 ? 2371 109849 14215 ? CCC 15248 454686 76478 ? DRPF 690776 12783322 3526141 ? SOLD 571561 8453658 3119881 ? ? 1277585 21691666 6722500
MERGE ,[object Object],[object Object],[object Object],[object Object],[object Object]
MERGE Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MERGE Cont’d  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
MERGE Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Skip Scanning of Indexes ,[object Object],[object Object],[object Object],[object Object],[object Object]
Index Compression  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
All my Indexes should be compressed, right?  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Temporary Tables ,[object Object],[object Object],[object Object],[object Object],[object Object]
Temporary Table Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Temporary Table Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Temporary Table Cont’d ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

More Related Content

What's hot

The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Traceoysteing
 
Oracle 9i notes(kamal.love@gmail.com)
Oracle 9i  notes(kamal.love@gmail.com)Oracle 9i  notes(kamal.love@gmail.com)
Oracle 9i notes(kamal.love@gmail.com)Kamal Raj
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Thuan Nguyen
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Thuan Nguyen
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007paulguerin
 
MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsAndrej Pashchenko
 

What's hot (20)

Single row functions
Single row functionsSingle row functions
Single row functions
 
Trig
TrigTrig
Trig
 
Les02
Les02Les02
Les02
 
SAS ODS HTML
SAS ODS HTMLSAS ODS HTML
SAS ODS HTML
 
Les01
Les01Les01
Les01
 
Les12 creating views
Les12 creating viewsLes12 creating views
Les12 creating views
 
Les04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple TableLes04 Displaying Data From Multiple Table
Les04 Displaying Data From Multiple Table
 
The MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer TraceThe MySQL Query Optimizer Explained Through Optimizer Trace
The MySQL Query Optimizer Explained Through Optimizer Trace
 
Les05 Aggregating Data Using Group Function
Les05 Aggregating Data Using Group FunctionLes05 Aggregating Data Using Group Function
Les05 Aggregating Data Using Group Function
 
Les10
Les10Les10
Les10
 
Oracle 9i notes(kamal.love@gmail.com)
Oracle 9i  notes(kamal.love@gmail.com)Oracle 9i  notes(kamal.love@gmail.com)
Oracle 9i notes(kamal.love@gmail.com)
 
Les00 Intoduction
Les00 IntoductionLes00 Intoduction
Les00 Intoduction
 
Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03Oracle - Program with PL/SQL - Lession 03
Oracle - Program with PL/SQL - Lession 03
 
Les01 Writing Basic Sql Statements
Les01 Writing Basic Sql StatementsLes01 Writing Basic Sql Statements
Les01 Writing Basic Sql Statements
 
Les06 Subqueries
Les06 SubqueriesLes06 Subqueries
Les06 Subqueries
 
Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07Oracle - Program with PL/SQL - Lession 07
Oracle - Program with PL/SQL - Lession 07
 
Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007Myth busters - performance tuning 101 2007
Myth busters - performance tuning 101 2007
 
Excel Conditional Formatting
Excel Conditional Formatting Excel Conditional Formatting
Excel Conditional Formatting
 
MERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known FacetsMERGE SQL Statement: Lesser Known Facets
MERGE SQL Statement: Lesser Known Facets
 
Les02 Restricting And Sorting Data
Les02 Restricting And Sorting DataLes02 Restricting And Sorting Data
Les02 Restricting And Sorting Data
 

Viewers also liked

Oracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & TricksOracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & TricksJeff Smith
 
Oracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningOracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningScott Jenner
 
Oracle applications sla r12 SLA- demos
Oracle applications sla r12   SLA- demosOracle applications sla r12   SLA- demos
Oracle applications sla r12 SLA- demosAli Ibrahim
 
Seminario de evangelizacao italia 2012
Seminario de evangelizacao italia 2012Seminario de evangelizacao italia 2012
Seminario de evangelizacao italia 2012Arlete Laenzlinger
 
sheila, marta,estela eta adur
sheila, marta,estela eta adursheila, marta,estela eta adur
sheila, marta,estela eta adursheila1033
 
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرض
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرضSadarah 5th-022.. ملامح قيادية عند الحيوان.. عرض
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرضAbdullah Ali
 
Duminica I din Post
Duminica I din PostDuminica I din Post
Duminica I din PostRadu Capan
 
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرض
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرضخوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرض
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرضAbdullah Ali
 
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرضAbdullah Ali
 
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرض
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرضSadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرض
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرضAbdullah Ali
 
Land Investments Expo 2014, KICC Nairobi Kenya
Land Investments Expo 2014, KICC Nairobi KenyaLand Investments Expo 2014, KICC Nairobi Kenya
Land Investments Expo 2014, KICC Nairobi KenyaSam Morara
 

Viewers also liked (20)

Oracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & TricksOracle SQL Developer Top 10 Tips & Tricks
Oracle SQL Developer Top 10 Tips & Tricks
 
Oracle R12 EBS Performance Tuning
Oracle R12 EBS Performance TuningOracle R12 EBS Performance Tuning
Oracle R12 EBS Performance Tuning
 
Supporting References in Oracle EBS R12
Supporting References in Oracle EBS R12Supporting References in Oracle EBS R12
Supporting References in Oracle EBS R12
 
Oracle applications sla r12 SLA- demos
Oracle applications sla r12   SLA- demosOracle applications sla r12   SLA- demos
Oracle applications sla r12 SLA- demos
 
Sla and cost acctg
Sla and cost acctgSla and cost acctg
Sla and cost acctg
 
FBLA-PBL History: Celebrating 70 Years!
FBLA-PBL History: Celebrating 70 Years!FBLA-PBL History: Celebrating 70 Years!
FBLA-PBL History: Celebrating 70 Years!
 
Seminario de evangelizacao italia 2012
Seminario de evangelizacao italia 2012Seminario de evangelizacao italia 2012
Seminario de evangelizacao italia 2012
 
sheila, marta,estela eta adur
sheila, marta,estela eta adursheila, marta,estela eta adur
sheila, marta,estela eta adur
 
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرض
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرضSadarah 5th-022.. ملامح قيادية عند الحيوان.. عرض
Sadarah 5th-022.. ملامح قيادية عند الحيوان.. عرض
 
Duminica I din Post
Duminica I din PostDuminica I din Post
Duminica I din Post
 
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرض
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرضخوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرض
خوارزميات صدارة.. الجودة في التسويق.. مختصر العرض.. عرض
 
SC
SCSC
SC
 
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض
‫Sadarah pmp-001.. المقدمة والتفسيرات.. عرض
 
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرض
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرضSadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرض
Sadarah 5th-030.. 5 أسئلة لتحديد العملاء.. عرض
 
Land Investments Expo 2014, KICC Nairobi Kenya
Land Investments Expo 2014, KICC Nairobi KenyaLand Investments Expo 2014, KICC Nairobi Kenya
Land Investments Expo 2014, KICC Nairobi Kenya
 
StartUp Sussex - Application Form June 2013
StartUp Sussex - Application Form June 2013StartUp Sussex - Application Form June 2013
StartUp Sussex - Application Form June 2013
 
Ghost Executive Group
Ghost Executive GroupGhost Executive Group
Ghost Executive Group
 
International Student Briefing - Effective Job Search Strategies
International Student Briefing - Effective Job Search StrategiesInternational Student Briefing - Effective Job Search Strategies
International Student Briefing - Effective Job Search Strategies
 
Azresidentialpropertiesinc management-5-6-2012
Azresidentialpropertiesinc management-5-6-2012Azresidentialpropertiesinc management-5-6-2012
Azresidentialpropertiesinc management-5-6-2012
 
Routes into Teaching 2016-17
Routes into Teaching 2016-17Routes into Teaching 2016-17
Routes into Teaching 2016-17
 

Similar to Oracle tips and tricks for joins, CASE statements, and more

Similar to Oracle tips and tricks for joins, CASE statements, and more (20)

Aggregate Functions,Final
Aggregate Functions,FinalAggregate Functions,Final
Aggregate Functions,Final
 
Oracle sql tuning
Oracle sql tuningOracle sql tuning
Oracle sql tuning
 
Chapter08
Chapter08Chapter08
Chapter08
 
Sql query [select, sub] 4
Sql query [select, sub] 4Sql query [select, sub] 4
Sql query [select, sub] 4
 
Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09Oracle - Program with PL/SQL - Lession 09
Oracle - Program with PL/SQL - Lession 09
 
SQL Notes
SQL NotesSQL Notes
SQL Notes
 
Beginers guide for oracle sql
Beginers guide for oracle sqlBeginers guide for oracle sql
Beginers guide for oracle sql
 
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek SharmaIntroduction to Oracle Functions--(SQL)--Abhishek Sharma
Introduction to Oracle Functions--(SQL)--Abhishek Sharma
 
Sql dml & tcl 2
Sql   dml & tcl 2Sql   dml & tcl 2
Sql dml & tcl 2
 
Ctes percona live_2017
Ctes percona live_2017Ctes percona live_2017
Ctes percona live_2017
 
Introduction to oracle functions
Introduction to oracle functionsIntroduction to oracle functions
Introduction to oracle functions
 
Oracle
OracleOracle
Oracle
 
Database development coding standards
Database development coding standardsDatabase development coding standards
Database development coding standards
 
Oracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |ThrissurOracle Training in Kochi | Trivandrum |Thrissur
Oracle Training in Kochi | Trivandrum |Thrissur
 
Chinabankppt
ChinabankpptChinabankppt
Chinabankppt
 
Sql
SqlSql
Sql
 
Complex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptxComplex Queries using MYSQL00123211.pptx
Complex Queries using MYSQL00123211.pptx
 
Select To Order By
Select  To  Order BySelect  To  Order By
Select To Order By
 
Business Intelligence Portfolio
Business Intelligence PortfolioBusiness Intelligence Portfolio
Business Intelligence Portfolio
 
My SQL.pptx
My SQL.pptxMy SQL.pptx
My SQL.pptx
 

More from Yanli Liu

Business English
Business EnglishBusiness English
Business EnglishYanli Liu
 
China History and Today
China History and TodayChina History and Today
China History and TodayYanli Liu
 
Air Cargo 101
Air Cargo 101Air Cargo 101
Air Cargo 101Yanli Liu
 
Blue Ocean Strategy
Blue Ocean StrategyBlue Ocean Strategy
Blue Ocean StrategyYanli Liu
 
The World Is Flat
The World Is FlatThe World Is Flat
The World Is FlatYanli Liu
 

More from Yanli Liu (9)

Business English
Business EnglishBusiness English
Business English
 
SAS Notes
SAS NotesSAS Notes
SAS Notes
 
China History and Today
China History and TodayChina History and Today
China History and Today
 
Air Cargo 101
Air Cargo 101Air Cargo 101
Air Cargo 101
 
Finance 101
Finance 101Finance 101
Finance 101
 
Blackswan
BlackswanBlackswan
Blackswan
 
Peak Oil
Peak OilPeak Oil
Peak Oil
 
Blue Ocean Strategy
Blue Ocean StrategyBlue Ocean Strategy
Blue Ocean Strategy
 
The World Is Flat
The World Is FlatThe World Is Flat
The World Is Flat
 

Recently uploaded

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 

Recently uploaded (20)

Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 

Oracle tips and tricks for joins, CASE statements, and more

  • 1. Oracle Tips & Tricks Feb 10, 2011 Shane Zhang
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. Group By Enhancements – Grouping Set select count(*) CNT, deptno, 'summary' as job from emp group by deptno UNION ALL select count(*), deptno, job from emp group by deptno, job / CNT DEPTNO JOB --- ---------- --------- 3 10 Summary 1 10 PRESIDENT 1 10 MANAGER 1 10 CLERK 5 20 Summary 1 20 MANAGER 2 20 CLERK 2 20 ANALYST 6 30 Summary 4 30 SALESMAN 1 30 MANAGER 1 30 CLERK select count(*) CNT, deptno , CASE GROUPING_ID(job) WHEN 1 THEN 'Summary' ELSE job END AS job from emp group by GROUPING SETS ( (deptno) , (deptno, job ) ) / CNT DEPTNO JOB --- ---------- --------- 3 10 Summary 1 10 PRESIDENT 1 10 MANAGER 1 10 CLERK 5 20 Summary 1 20 MANAGER 2 20 CLERK 2 20 ANALYST 6 30 Summary 4 30 SALESMAN 1 30 MANAGER 1 30 CLERK Union all method, multiple table scan , slow New method, fast
  • 22.
  • 23.
  • 24. ROLLUP Example Output SHP_RCV_SRC_CD TNDR_TYPE_CD SUM(A.NBR_OF_PKGS) SUM(A.NET_REV) SUM(A.RATD_WGT) 3 CCC 15204 452297 76297 3 DRPF 688169 12653173 3509281 3 SOLD 570572 8422926 3112950 3 ? 1273945 21528396 6698529 4 CCC 26 1414 100 4 DRPF 484 28301 4350 4 SOLD 759 23706 5306 4 ? 1269 53421 9756 5 CCC 18 975 80 5 DRPF 2123 101847 12510 5 SOLD 230 7026 1625 5 ? 2371 109849 14215 ? ? 1277585 21691666 6722500
  • 25.
  • 26. CUBE Example Output SHP_RCV_SRC_CD TNDR_TYPE_CD SUM(A.NBR_OF_PKGS) SUM(A.NET_REV) SUM(A.RATD_WGT) 3 CCC 15204 452297 76297 3 DRPF 688169 12653173 3509281 3 SOLD 570572 8422926 3112950 3 ? 1273945 21528396 6698529 4 CCC 26 1414 100 4 DRPF 484 28301 4350 4 SOLD 759 23706 5306 4 ? 1269 53421 9756 5 CCC 18 975 80 5 DRPF 2123 101847 12510 5 SOLD 230 7026 1625 5 ? 2371 109849 14215 ? CCC 15248 454686 76478 ? DRPF 690776 12783322 3526141 ? SOLD 571561 8453658 3119881 ? ? 1277585 21691666 6722500
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.