1 / 16

SQL Tips & Tricks

SQL Tips & Tricks. Getting more done with SQL DML statements. Lannois Carroll-Woolery, IST. Disclaimers. “This isn’t what I expected…” “I know a better way...” “It worked when you did it…”. Useful DML Techniques. Conditional logic Crosstab reports Running Totals

carney
Download Presentation

SQL Tips & Tricks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SQL Tips & Tricks Getting more done with SQL DML statements Lannois Carroll-Woolery, IST

  2. Disclaimers • “This isn’t what I expected…” • “I know a better way...” • “It worked when you did it…”

  3. Useful DML Techniques • Conditional logic • Crosstab reports • Running Totals • Generating a list of dates • Counting the number of working days • Generating date ranges from Eff. Dates • Histograms • Hierarchical Queries

  4. Round the World Itinerary

  5. Table PS_FLIGHTS

  6. “What currencies will I need?”Conditional Logic

  7. “What days of the week will I fly?”Crosstab reports

  8. “How many miles have I travelled so far?” Running Totals

  9. “Can I make a detailed itinerary?”Generating a list of dates

  10. “How many Vacation Days do I need?”Calc. Elapsed Working Days

  11. “What dates will I be in each country?”Date Ranges from Effective-Dated tables

  12. “I only like afternoon flights…”Histograms

  13. “I need my manager’s boss’ approval…”Hierarchical Queries 1/2

  14. “I’m going over his/her head…”Hierarchical Queries 2/2

  15. Questions? • Conditional logic • Crosstab reports • Running Totals • Generating a list of dates • Counting the number of working days • Generating date ranges from Eff. Dates • Histograms • Hierarchical Queries

  16. References • http://www.oracle.com/technetwork/issue-archive/index-093676.html • http://www.oracle.com/pls/db102/portal.all_books#index-SQL • http://www.orafaq.com/wiki/SQL_FAQ#How_does_one_code_a_matrix.2Fcrosstab.2Fpivot_report_in_SQL.3F • http://consultingblogs.emc.com/jamespipe/archive/2007/01/15/Oracle-SQL-_2D00_-Generate-a-list-of-dates.aspx • http://www.orafaq.com/node/55 • Money Sense magazine. September/October 2010

More Related