180 likes | 419 Views
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
E N D
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 • Generating a list of dates • Counting the number of working days • Generating date ranges from Eff. Dates • Histograms • Hierarchical Queries
“Can I make a detailed itinerary?”Generating a list of dates
“How many Vacation Days do I need?”Calc. Elapsed Working Days
“What dates will I be in each country?”Date Ranges from Effective-Dated tables
“I need my manager’s boss’ approval…”Hierarchical Queries 1/2
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
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