1Jonathan Lewis UKOUG Dec 2000 Analytic Functions Agenda Who am I Historical Problems The Future Questions (and answers)

Slides:



Advertisements
Similar presentations
Analytic Functions : An Oracle Developer’s Best Friend
Advertisements

How the CBO works Jonathan Lewis
1Jonathan Lewis EOUG Jun 2000 Execution Plans Explain Plan - part 2 Parallel - Partitions - Problems.
CH 27. * Data were collected on 208 boys and 206 girls. Parents reported the month of the baby’s birth and age (in weeks) at which their child first crawled.
5.1Database System Concepts - 6 th Edition Chapter 5: Advanced SQL Advanced Aggregation Features OLAP.
Musical Chairs! Change your table groups. One person may remain at each table. The remaining students move to another table—each going to a different new.
©Silberschatz, Korth and Sudarshan22.1Database System Concepts 4 th Edition 1 Extended Aggregation SQL-92 aggregation quite limited  Many useful aggregates.
Copyright: Silberschatz, Korth and Sudarshan 1 OLAP Functions Order-Dependent Aggregates and Windows in SQL: SQL: same as SQL:1999.
By Hao Sun.  A continuation of some discussions from last time  Why JPM and BAC?  To see the realized covariance and systematic co- jumps during the.
TITLE OF YOUR PROJECT. INTRODUCTION Type here about your science fair project Why you are interested in working on this idea. Why you think your project.
Oracle 10g analytical SQL for Business Intelligence Reporting Simay Alpoge Next Information Systems, Inc. Next Information Systems, Inc.
ADVANCED EXCEL FORMULAS 1 Lesson 8. Named Ranges Name a cell or a range of cells Can make formulas easy to understand =SUM(Sales) instead of =SUM(A2:A16)
Xin  Syntax ◦ SELECT field1 AS title1, field2 AS title2,... ◦ FROM table1, table2 ◦ WHERE conditions  Make a query that returns all records.
Building an Information Community: IT and Research Working Together Web Tools for Enrollment Management By Ken Meehan, Research, Fullerton College Bob.
SAGE Computing Services Customised Oracle Training Workshops and Consulting Are you making the most of PL/SQL? Hints and tricks and things you may have.
Market Research Presentation Template [Date] FINCA [Subsidiary]
JumpStart Write down your learning style
The Model Clause explained Tony Hasler, UKOUG Birmingham 2012 Tony Hasler, Anvil Computer Services Ltd.
Oracle Analytic Functions for IR Analysis and Reporting Mingguang Xu and Denise Gardner Office of Institutional Research University of Georgia.
Mark Inman U.S. Navy (Naval Sea Logistics Center) Session #213 Analytic SQL for Beginners.
Hadoop System simulation with Mumak Fei Dong, Tianyu Feng, Hong Zhang Dec 8, 2010.
Name of project Research topic/thesis title Malin specializes in running projects and activities in cooperation with industry. Malin is managing the project.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 2.
Linear Regression. Determine if there is a linear correlation between horsepower and fuel consumption for these five vehicles by creating a scatter plot.
More Windowing Functions KEVIN MCCARTY. What are Windowing Functions Again? Introduced in SQL Server 2005 (SQL 2003 Standard) Used to provide operations.
Pivot Table Training. Agenda Purpose of a Pivot Table Creating a Pivot Table: Count Tailoring Your Information Cloning Pivot Tables Behind the Scenes:
Projectile Lab 9/30/13. Objective: To determine effect on projectiles if we include air resistance.
The Burden of Proof Jonathan Lewis
 May be times when we need calculations in a report. ◦ Total of how much a salesman has sold ◦ Report showing total inservice training hours an employee.
Analyzing Your Data with Analytic Functions Carl Dudley University of Wolverhampton, UK UKOUG Council Oracle ACE Director
Background Lots of Demos(That’s it.)
TITLE OF YOUR PROJECT. INTRODUCTION Type here about your science fair project Why you are interested in working on this idea. Why you think your project.
DATABASES
DBI309: Using SQL Server 2012 Window Functions to Solve Common T-SQL Challenges Steven Wang MCITP – BI, Database Developer and DBA.
Conjoint Analysis. 1. Managers frequently want to know what utility a particular product feature or service feature will have for a consumer. 2. Conjoint.
T-SQL Power! Windows That Open Doors Adam
Presentation Title.
Presentation Title.
TITLE OF YOUR PROJECT.
Year 5 - Numeracy Title page..
ACTi Retail Big Data Solutions
Analytic Window Functions
Using Simulation to Estimate Probabilities
The Perfect Business Plan.
Advanced Teradata SQL GLOBAL Temporary Vs VOLATILE Temporary Vs Derived tables WITH and WITH BY Special Index function Trigger Online Analytical Function.
Oracle TP One day training Dragutin Jastrebic.
Using Window Ranking, Offset, and Aggregate Functions
I WANT TO HOLD YOUR HAND 1ST TOP 100 SINGLE
An Introduction to Saint-Gobain 2017
Procurement Management Information System (PMIS)
Instructions for Making a Bar Graph
Writing Better Queries with Window Functions
Oracle8i Analytical SQL Features
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
Introduction to Window Functions
Data Analysis with SQL Window Functions
On your whiteboards, show me…
Group 1 Group 1 Group 1 Group 1 word word word word word word word word word word word word word word word word word word word word word word word.
Probability and Simulation
What can I do with a math major?
Relations, Domain and Range
1: multiple representations
Count on 2 (Over the bridge)
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
OLAP Functions Order-Dependent Aggregates and Windows in SQL: SQL: same as SQL:1999.
Presentation Title Your information.
Database Programming Using Oracle 11g
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
TEL031 ODL Analytics Main Activities
OWNER AND MANAGER BRIEFING JUNE 2014
Presentation transcript:

1Jonathan Lewis UKOUG Dec 2000 Analytic Functions Agenda Who am I Historical Problems The Future Questions (and answers)

2Jonathan Lewis UKOUG Dec 2000 Analytic Functions Who am I ? Independent Consultant. Design, Strategy, Briefing, Training Reviews and Trouble-shooting

3Jonathan Lewis UKOUG Dec 2000 Analytic Functions History For each store report the two top sellers

4Jonathan Lewis UKOUG Dec 2000 Analytic Functions History create table game_sale ( titlevarchar2(20), storevarchar2(10), salesnumber(10,2) );

5Jonathan Lewis UKOUG Dec 2000 Analytic Functions History ('Portal Combat', 'London', 1824); ('Manic the Gerbil', 'London', 52); ('Age of Umpires', 'London', 110); ('Crash Simulator', 'London', 247); ('Dome', 'London', 2167);

6Jonathan Lewis UKOUG Dec 2000 Analytic Functions History select store, title, sales from game_sale order by store, sales desc

7Jonathan Lewis UKOUG Dec 2000 Analytic Functions History Glasgow Crash Simulator 1934 Manic the Gerbil 913 Dome 482 Portal Combat 315 Age of Umpires 72 London Dome 2167 Portal Combat 1824 Crash Simulator 247 Age of Umpires 110 Manic the Gerbil 52

8Jonathan Lewis UKOUG Dec 2000 Analytic Functions History declare cursor c1 is select store, title, sales fromgame_sale order by store, sales desc ; m_last_row c1%rowtype; m_out_ctnumber := 0; begin do something... end;

9Jonathan Lewis UKOUG Dec 2000 Analytic Functions History for r1 in c1 loop if (m_last_row.store != r1.store) then m_out_ct := 0; dbms_output.new_line; end if; if m_out_ct != 2 then dbms_output.put_line ( r1.store || ' - ' || r1.title || ' - ' || r1.sales ); m_out_ct := m_out_ct + 1; end if; m_last_row := r1; end loop;

10Jonathan Lewis UKOUG Dec 2000 Analytic Functions History Glasgow - Crash Simulator Glasgow - Manic the Gerbil London - Dome London - Portal Combat

11Jonathan Lewis UKOUG Dec 2000 Analytic Functions History ('Portal Combat', 'London', 1824); ('Manic the Gerbil', 'London', 52); ('Age of Umpires', 'London', 110); ('Crash Simulator', 'London', 1824); ('Dome', 'London', 2167);

12Jonathan Lewis UKOUG Dec 2000 Analytic Functions History selectstore, title, sales fromgame_sale gs1 where2 > ( selectcount(*) fromgame_sale gs2 wheregs2.store = gs1.store andgs2.sales > gs1.sales ) order by store, sales desc;

13Jonathan Lewis UKOUG Dec 2000 Analytic Functions History STORE TITLE SALES Glasgow Crash Simulator 1934 Manic the Gerbil 913 London Dome 2167 Portal Combat 1824

14Jonathan Lewis UKOUG Dec 2000 Analytic Functions History ('Portal Combat', 'London', 1824); ('Manic the Gerbil', 'London', 52); ('Age of Umpires', 'London', 110); ('Crash Simulator', 'London', 1824); ('Dome', 'London', 2167); where2 > ( selectcount(*)

15Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future. select store, title, sales, rank() over ( partition by store order by sales desc ) as in_store_rank from game_sale ;

16Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future Glasgow Crash Simulator Manic the Gerbil Dome Portal Combat Age of Umpires 72 5 London Dome Portal Combat Crash Simulator Age of Umpires Manic the Gerbil 52 5

17Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future select store, title, sales from(selectstore, title, sales, rank() over ( partition by store order by sales desc ) as in_store_rank from game_sale ) wherein_store_rank <= 2 order bystore, in_store_rank;

18Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future STORE TITLE SALES Glasgow Crash Simulator 1934 Tonic the Gerbil 913 London Dome 2167 Portal Combat 1824

19Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future select store, title, sales from(select store, title, sales, rank() over ( partition by store order by sales desc ) as in_store_rank, sum(sales) over ( partition by store ) as store_totals fromgame_sale) wherein_store_rank <= 2 order bystore_totals desc, in_store_rank;

20Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future STORE TITLE SALES London Dome 2167 Portal Combat 1824 Glasgow Crash Simulator 1934 Tonic the Gerbil 913

21Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future AVGSUM** COUNT MAXMIN RANK** ROW_NUMBER DENSE_RANKPERCENT_RANK

22Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future RATIO_TO_REPORT LEADLAG FIRST_VALUELAST_VALUE NTILECUME_DIST

23Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future VARIANCESTDDEV CORR VAR_POPVAR_SAMP COVAR_POPCOVAR_SAMP STDDEV_POP STDDEV_SAMP REGR_ (linear regression function)

24Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future Title Sales Previous Delta Crash Simulator Tonic the Gerbil Dome Portal Combat Age of Umpires 72

25Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future selecttitle, sales, previous, this_sale - next_sale delta from ( selecttitle, sales, lead(sales,1) over ( partition by store order by sales desc ) as previous from game_sale );

26Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future Store Title Sale St % Co % Glasgow Crash Simulator Tonic the Gerbil Dome Portal Combat Age of Umpires London Dome Portal Combat Crash Simulator Age of Umpires Tonic the Gerbil

27Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future selectstore, title, sales, ratio_to_report(sales) over ( partition by store )store_ratio, ratio_to_report(sales) over ( )country_ratio fromgame_sale order by store, sales desc;

28Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future StoreWeek EndingSalesRolling Glasgow07-May-20004,0005, May-20005,0005, May-20006,0006, May-20007,0006, Jun-20008,0007, Jun-20007,8027, Jun-20007,6367, Jun-20008,1347, Jul-20007,8157, Jul-20008,0237,990.7

29Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future select store, week_ending, sales, avg(sales) over( partition by store order by week_ending range between 14 preceding and 14 following )rolling_5 from sales_history order by store, week_ending;

30Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future StoreWeek EndingSalesRunning Glasgow07-May-20004,000 4, May-20005,000 9, May-20006,000 15, May-20007,000 22, Jun-20008,000 30, Jun-20007,802 37, Jun-20007,636 45, Jun-20008,134 53,572 2-Jul-20007,815 61,387 9-Jul-20008,023 69,410

31Jonathan Lewis UKOUG Dec 2000 Analytic Functions The Future select store, week_ending, sales, avg(sales) over( partition by store order by week_ending range unbounded preceding )running from sales_history order by store, week_ending;

32Jonathan Lewis UKOUG Dec 2000 Analytic Functions Warnings Lots of sorting. Use only on small result sets pl/sql doesn’t understand it can’t often use view effectively

33Jonathan Lewis UKOUG Dec 2000 Analytic Functions Conclusion Enormously powerful Use in-line views to make it easy