Do IT with SQL

323 views

Published on

Published in: Software, Technology
1 Comment
0 Likes
Statistics
Notes
  • Be the first to like this

No Downloads
Views
Total views
323
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
25
Comments
1
Likes
0
Embeds 0
No embeds

No notes for slide

Do IT with SQL

  1. 1. DO IT WITH SQL PHP Indenesia Meetup 201404
  2. 2. ABOUT ME  Editor PojokProgrammer.net  Writers Welcome!  CEO BiruniLabs  Trainers Welcome!
  3. 3. WHATYOU NEED  Laptop or Computer  RDBMS Installed  MySQL  PostgreSQL  Oracle  Whatever....  SQL Interface  HeidiSQL  SQLyog  phpMyAdmin  Whatever.....  Your Brain 
  4. 4. BRAIN GYM
  5. 5. AREYOU READY ?
  6. 6. HISTORY IBM Research for System R  SEQUEL Relational Software Inc. developed their own version  Oracle v2 (1979) IBM released DB2 based on System R (1983) Becoming Standard  ANSI SQL-86  ANSI SQL-92
  7. 7. RULE OFTHUMB FromTom Kyte, Oracle Evangelist 1. Use single SQL statement whenever possible 2. Use PL/SQL or Stored Procedure 3. Use Java (or other programming language) 4. Rethink why you want to do it (refine your approach)
  8. 8. SQL ANATOMY  Statements  Queries  Clauses  Predicates  Expressions
  9. 9. SELECT SELECT b,d,e,h FROM some_table ; SELECT * FROM some_table WHERE x IN (3,5,6,8) ; SELECT b,d,e,h FROM some_table WHERE x IN (3,5,6,8) ;
  10. 10. JOINVS UNION JOIN UNION (UNION ALL)
  11. 11. JOIN  INNER JOIN (JOIN)  LEFT OUTER JOIN (LEFT JOIN)  RIGHT OUTER JOIN (RIGHT JOIN)  FULL OUTER JOIN (FULL JOIN)  LEFT JOIN EXCLUDING INNER JOIN (LEFT EXCLUDING JOIN)  RIGHT JOIN EXCLUDING INNER JOIN (RIGHT EXCLUDING JOIN)  OUTER JOIN EXCLUDING INNER JOIN (OUTER EXCLUDING JOIN)
  12. 12. VISUAL REPRESENTATION
  13. 13. SOME LOGIC 3VL (3Value Logic) Conditional Expression  True  False  Null  CASE (ANSI)  COALESCE (ANSI)  DECODE (Oracle)  IFNULL (MySQL)  ISNULL (SQL Server)
  14. 14. AGGREGATES SUM() COUNT() MAX() MIN() AVG() CROSS TABS
  15. 15. ANALYTIC FUNCTIONS  ROW_NUMBER() OVER()  SUM() OVER()  COUNT() OVER()  MAX() OVER()  MIN() OVER()  AVG() OVER()
  16. 16. TRIGGERS & STORED PROCEDURES  When to Use?  How to Use?
  17. 17. TUNING  Optimizing Queries  Optimizing Index  Optimizing Server
  18. 18. THANKYOU Questions and Answers

×