Difference between SQL Queries

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nikpreek
    New Member
    • Jun 2007
    • 22

    #1

    Difference between SQL Queries

    Hi All,

    I know its very basic question and event I know the answer for this. But I haven't found any proof of this. Is there any difference between thse queries (given below at end of post)? (In terms of performance)
    • I'm using SQL 2000 and 2005 both.
    • When I check with "Esimated Execution Plan", there is no difference (50% each), but there is very little data in my tables.
    • I feel, Query 1 is preferred style of T-SQL developers and Query 2 is preferred Style of PL/SQL developers.
    • Query 2 runs much faster is Oracle 9i (I had worked earlier)


    Query 1:
    Code:
    Select 	Cust.CustomerID, Cust.CustomerCode, Cust.FullCustName, 
    	Cycl.CycleID, Cycl.CycleCode,
    	Jobs.JobID, Jobs.JobNo, Files.FileID, Files.[FileName], 
    	Files.FileSize, Files.Status
    From 	CustomerCode Cust INNER JOIN Setup Setu ON Cust.CustomerID = Setu.CustomerID 
    	INNER JOIN FSECycles Cycl ON Setu.SetupID = Cycl.SetupID
    	INNER JOIN FSEJobs Jobs ON Cycl.CycleID = Jobs.CycleID 
    	INNER JOIN FSEFiles Files ON Jobs.JobID = Files.JobID
    Query 2:
    Code:
    Select 	Cust.CustomerID, Cust.CustomerCode, Cust.FullCustName, 
    	Cycl.CycleID, Cycl.CycleCode,
    	Jobs.JobID, Jobs.JobNo, Files.FileID, Files.[FileName], 
    	Files.FileSize, Files.Status
    From 	CustomerCode Cust, Setup Setu, FSECycles Cycl,
    	FSEJobs Jobs, FSEFiles Files
    Where Cust.CustomerID = Setu.CustomerID 
    And Setu.SetupID = Cycl.SetupID
    And Cycl.CycleID = Jobs.CycleID
    And Jobs.JobID = Files.JobID
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    In the first query you are using INNER JOIN syntax explicitely. this is as per ANSI specifications . Performance wise this is faster than the second one.

    Comment

    • nikpreek
      New Member
      • Jun 2007
      • 22

      #3
      Thanks mate.
      Is there any more detailed description available on net?

      Thanks in advance.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Originally posted by nikpreek
        Thanks mate.
        Is there any more detailed description available on net?
        Yes of course .
        But only you need to search for that.

        Comment

        Working...