469,623 Members | 1,544 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,623 developers. It's quick & easy.

Difference between SQL Queries

nikpreek
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:
Expand|Select|Wrap|Line Numbers
  1. Select     Cust.CustomerID, Cust.CustomerCode, Cust.FullCustName, 
  2.     Cycl.CycleID, Cycl.CycleCode,
  3.     Jobs.JobID, Jobs.JobNo, Files.FileID, Files.[FileName], 
  4.     Files.FileSize, Files.Status
  5. From     CustomerCode Cust INNER JOIN Setup Setu ON Cust.CustomerID = Setu.CustomerID 
  6.     INNER JOIN FSECycles Cycl ON Setu.SetupID = Cycl.SetupID
  7.     INNER JOIN FSEJobs Jobs ON Cycl.CycleID = Jobs.CycleID 
  8.     INNER JOIN FSEFiles Files ON Jobs.JobID = Files.JobID
  9.  
Query 2:
Expand|Select|Wrap|Line Numbers
  1. Select     Cust.CustomerID, Cust.CustomerCode, Cust.FullCustName, 
  2.     Cycl.CycleID, Cycl.CycleCode,
  3.     Jobs.JobID, Jobs.JobNo, Files.FileID, Files.[FileName], 
  4.     Files.FileSize, Files.Status
  5. From     CustomerCode Cust, Setup Setu, FSECycles Cycl,
  6.     FSEJobs Jobs, FSEFiles Files
  7. Where Cust.CustomerID = Setu.CustomerID 
  8. And Setu.SetupID = Cycl.SetupID
  9. And Cycl.CycleID = Jobs.CycleID
  10. And Jobs.JobID = Files.JobID
  11.  
Sep 3 '07 #1
3 1629
debasisdas
8,127 Expert 4TB
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.
Sep 3 '07 #2
Thanks mate.
Is there any more detailed description available on net?

Thanks in advance.
Sep 3 '07 #3
debasisdas
8,127 Expert 4TB
Thanks mate.
Is there any more detailed description available on net?
Yes of course .
But only you need to search for that.
Sep 5 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Shane Niebergall | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.