Amazing New Tool for Learning and Debugging SQL

RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
SQL Fiddle! Build your schema and insert data then run queries and even see the execution plan. You can use multiple RDMSes including Oracle and SQL Server 2012.

Here is an example: SQL Fiddle

Comments

  • Excellent1Excellent1 Member Posts: 462 ■■■■■■■□□□
    Awesome, thanks for the share. Might want to edit your link, though, if that is your real birthday.

    Thanks.
  • erpadminerpadmin Member Posts: 4,165 ■■■■■■■■■■
    He's a fellow Virgo! :)
  • N2ITN2IT Inactive Imported Users Posts: 7,483 ■■■■■■■■■■
    Great toolset thanks for sharing.
  • amcnowamcnow Member Posts: 215 ■■■■□□□□□□
    Thanks for the link. icon_study.gif
    WGU - Master of Science, Cybersecurity and Information Assurance
    Completed: JIT2, TFT2, VLT2, C701, C702, C706, C700, FXT2
    In Progress: C688
    Remaining: LQT2
    Aristotle wrote:
    For the things we have to learn before we can do them, we learn by doing them.
  • NotHackingYouNotHackingYou Member Posts: 1,460 ■■■■■■■■□□
    Cool, thanks for sharing
    When you go the extra mile, there's no traffic.
  • RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    So you have a Table, let's say joined Sales Order Detail with Part, and Inventories and you need to get the most recent SO for each part number. How would you write the query?

    Here is a simplified schema:
    CREATE TABLE [dbo].[Part]
    (
       [part_no] VARCHAR(5)
      ,[rev] CHAR
      ,[on_hand] TINYINT
      ,[safety_stock] TINYINT
      ,[so_no] VARCHAR(5)
      ,[so_date] DATETIME
    )
    
    
    
    
    INSERT [dbo].[Part]
    SELECT '12345', 'A', 10, 15, 'S1234', '12/14/2009' UNION ALL
    SELECT '12345', 'A', 10, 15, 'S1233', '10/01/2009' UNION ALL
    SELECT '12345', 'A', 10, 15, 'S1232', '08/02/2009' UNION ALL
    SELECT '12346', '',  5, 0, 'S1231', '08/01/2009' UNION ALL
    SELECT '12347', '-', 0, 0, 'S1230', '10/20/2009' UNION ALL
    SELECT '12347', '-', 0, 0, 'S1229', '07/15/2009'
    

    Here is a potential answer:
    SQL Fiddle
Sign In or Register to comment.