|
-
Oct 4th, 2010, 07:42 AM
#1
So You Wanna Be An SQL Server DBA...
If so, then here is an article worth taking a moment to read.
http://www.databasejournal.com/featu...61/article.htm
I'm not the least bit interested in becoming a DBA, but I did find one note worthy thing...I have been writing "correlated sub queries" for years and did not know that is what they are called?
-
Oct 4th, 2010, 07:54 AM
#2
Re: So You Wanna Be An SQL Server DBA...
Yep, they're even called that in Jet databases. From the MSDN Library:
Intermediate Microsoft Jet SQL for Access 2000
The EXISTS subquery
The EXISTS predicate is used in subqueries to check for the existence of values in a result set. In other words, if the subquery does not return any rows, the comparison is False. If it does return one or more rows, the comparison is True.
Code:
SELECT *
FROM tblCustomers AS A
WHERE EXISTS
(SELECT * FROM tblInvoices
WHERE A.CustomerID = tblInvoices.CustomerID)
Note that in the previous SQL statement an alias is used on the tblCustomers table. This is so that we can later refer to it in the subquery. When a subquery is linked to the main query in this manner, it is called a correlated query.
-
Oct 4th, 2010, 07:59 AM
#3
Re: So You Wanna Be An SQL Server DBA...
I am interested, to start
Please mark you thread resolved using the Thread Tools as shown
-
Oct 4th, 2010, 08:05 AM
#4
Re: So You Wanna Be An SQL Server DBA...
But as a DBA the question should be what is there any thing wrong with using correlated sub queries? What if the result set is large?
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Oct 4th, 2010, 09:22 AM
#5
Re: So You Wanna Be An SQL Server DBA...
 Originally Posted by Hack
If so, then here is an article worth taking a moment to read.
http://www.databasejournal.com/featu...61/article.htm
I'm not the least bit interested in becoming a DBA, but I did find one note worthy thing...I have been writing "correlated sub queries" for years and did not know that is what they are called? 
Ahh, so that's what it's called. Yeah, I've been doing that for years too. Now I've lost my innocence!
No ... I wouldn't want to be a DBA either. Seems to me to be too much like herding cats.
http://www.youtube.com/watch?v=VrlV-cG35nI
-Max
The name's "Peck" .... "Max Peck"
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." - Red Adair
-
Oct 5th, 2010, 03:31 PM
#6
Re: So You Wanna Be An SQL Server DBA...
If you want to be a DBA then this song is worth remembering.
-
Oct 5th, 2010, 06:24 PM
#7
Re: So You Wanna Be An SQL Server DBA...
in 20+ years, I had never encountered correlated queries until my current employment. Quite frankly, they confuse me and aren't intuitive.
-tg
-
Oct 6th, 2010, 07:43 AM
#8
Re: So You Wanna Be An SQL Server DBA...
I use them but they really need to be thought about. Would you want to run the correlated query (which runs against every row) if you were pulling a record set with millions of rows? I would say this would be a problem.
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Oct 7th, 2010, 05:00 AM
#9
Re: So You Wanna Be An SQL Server DBA...
I'm going to go out on a limb here and suggest that the correlated query - in an EXISTS() function - never returns any rows. It just makes it as far as the INDEX SEEK/SCAN or TABLE SCAN - finds that a row exists - and then it's job is done.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|