Do IT with SQL
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to like this
No Downloads

Views

Total Views
194
On Slideshare
193
From Embeds
1
Number of Embeds
1

Actions

Shares
Downloads
17
Comments
1
Likes
0

Embeds 1

http://www.slideee.com 1

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. DO IT WITH SQL PHP Indenesia Meetup 201404
  • 2. ABOUT ME  Editor PojokProgrammer.net  Writers Welcome!  CEO BiruniLabs  Trainers Welcome!
  • 3. WHATYOU NEED  Laptop or Computer  RDBMS Installed  MySQL  PostgreSQL  Oracle  Whatever....  SQL Interface  HeidiSQL  SQLyog  phpMyAdmin  Whatever.....  Your Brain 
  • 4. BRAIN GYM
  • 5. AREYOU READY ?
  • 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. 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. SQL ANATOMY  Statements  Queries  Clauses  Predicates  Expressions
  • 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. JOINVS UNION JOIN UNION (UNION ALL)
  • 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. VISUAL REPRESENTATION
  • 13. SOME LOGIC 3VL (3Value Logic) Conditional Expression  True  False  Null  CASE (ANSI)  COALESCE (ANSI)  DECODE (Oracle)  IFNULL (MySQL)  ISNULL (SQL Server)
  • 14. AGGREGATES SUM() COUNT() MAX() MIN() AVG() CROSS TABS
  • 15. ANALYTIC FUNCTIONS  ROW_NUMBER() OVER()  SUM() OVER()  COUNT() OVER()  MAX() OVER()  MIN() OVER()  AVG() OVER()
  • 16. TRIGGERS & STORED PROCEDURES  When to Use?  How to Use?
  • 17. TUNING  Optimizing Queries  Optimizing Index  Optimizing Server
  • 18. THANKYOU Questions and Answers