473,394 Members | 1,709 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Optimal SQL

Please excuse what is probably a no-brainer, but here goes.

Is there any difference, in terms of performance or any other pertinent
factor, between:

SELECT * FROM tblCustomers INNER JOIN tblCustomerOrders ON
tblCustomers.fldCustomerID = tblCustomerOrders.fldCustomerID

and

SELECT * FROM tblCustomers, tblCustomerOrders WHERE
tblCustomers.fldCustomerID = tblCustomerOrders.fldCustomerID

I note that if I type the latter into the SQL pane in a Data window,
SQL Server replaces it with the former.

TIA

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk

Jul 23 '05 #1
3 1213
Should give the same query plan.

Nigel Rivett
www.nigelrivett.net

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #2
If you examine the execution plans in Query Analyzer you will find the two
statements are identical. For INNER JOINs either syntax is legal and which
you use really comes down to readability and personal preference.
I note that if I type the latter into the SQL pane in a Data window,
SQL Server replaces it with the former.


One reason to avoid GUI query tools is that they tend to mess with the
formatting and syntax of your code. My advice is to use a proper query
editor, like Query Analyzer. In the long run you'll find you can write
better code much quicker that way.

--
David Portas
SQL Server MVP
--
Jul 23 '05 #3
David Portas wrote:
If you examine the execution plans in Query Analyzer you will find the two statements are identical. For INNER JOINs either syntax is legal and which you use really comes down to readability and personal preference.
I note that if I type the latter into the SQL pane in a Data window, SQL Server replaces it with the former.
One reason to avoid GUI query tools is that they tend to mess with

the formatting and syntax of your code. My advice is to use a proper query editor, like Query Analyzer. In the long run you'll find you can write better code much quicker that way.

Thanks to you and Nigel. I agree with your distress at the way the GUI
tool in SQL Server messes with code - I like to have things laid out
just so, and it's no business of SQL Server to do it's nanny thing.
But that's Microsoft for you, the company that brought us Office
Assistant.

Unfortunately, for very involved outer joins with multiple tables, I'm
just not expert enough to craft the thing in QA, or rather I like to
see a graphical representation of the table relations. But I suppose I
could write it in QA, then paste it into a Data pane and see what the
GUI made of it.

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk
--
We are what we repeatedly do. Excellence, then, is not an act, but a
habit - Aristotle

Those heights by great men reached and kept
Were not obtained by sudden flight,
But they, while their companions slept
Were toiling upward in the night
- Longfellow

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Thomas | last post by:
Hi! How can i get the optimal richtext width size, when depending on the variable text lengh. The text can be colored or with some differnt fontsizes. I dont want use scrollbars. Is there a...
2
by: Gary | last post by:
I am working with a report generator that is based on SQL Server 2000 and uses ASP as the UI. Basically we have a set of reports that end users can execute through a web browser. In general the...
10
by: Tom | last post by:
Hi I am looking for an optimal data-structure in order to replace a map<int,float>. I use it as some kind of sparse array representation. The facts: - the population in the data-structures...
25
by: Johan Bergman | last post by:
Hi, Maybe someone can help me to optimize this C/C++ implementation of a FIR filter (although I realize that I should probably consider an FFT approach instead.) The example below calculates...
3
by: Amy L. | last post by:
Is there a Buffer size that is optimial based on the framework or OS that is optimal when working with chunks of data? Also, is there a point where the buffer size might not be optimal (too...
4
by: Joe Lester | last post by:
I'm trying to figure out what the optimal Postgres configuration would be for my server (with 200 connecting clients, even though I'd really like to get it up to 500). I've got a 700 MHz eMac...
11
by: Mahesh S | last post by:
Hi I recently wrote a user defined function in SQl to run in db2 and it works fine. But I seem to get a warning saying that the performance is sub-optimal. Here is the warning message: ...
1
by: khipro | last post by:
Here i have coded algorithm for Optimal Binary Search Tree but not getting correct result can anybody help me (it is executing but result is not desired)? #include<iostream> using std::cin;...
1
by: Rudolf Bargholz | last post by:
Hi, We have created triggers to log modifications to tables in our application. The triggers work fine, just on one of the tables in our database the triggers fail with the error message...
1
by: almurph | last post by:
Folks, I want to modify the Needleman Wunsch algorithm (pseudo-code here: http://en.wikipedia.org/wiki/Needleman-Wunsch_algorithm) so that it produces more than the optimal solution. What I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.