Showing posts with label mcse. Show all posts
Showing posts with label mcse. Show all posts

Thursday, 8 March 2012

Confusion over "ANY" keyword

I am studying for the MSCE/MCDBA exam 70-229. In the book I am using
("MCSA/MCSE/MCDBA Self-Paced Training Kit: Microsoft SQL Server 2000
Database Design and Implementation Exam 70-229, Second Edition") I am
looking at the section on the ANY/ALL keyword.

<QUOTE>
USE Pubs
SELECT Title
FROM Titles
WHERE Advance > ANY
(
SELECT Advance
FROM Publishers INNER JOIN Titles
ON Titles.Pub_id = Publishers.Pub_id
AND Pub_name = 'Algodata Infosystems')

This statement finds the titles that received an advance larger than
the minimum advance amount paid by Algodata Infosystems (which, in this
case, is $5,000). The WHERE clause in the outer SELECT statement
contains a subquery that uses a join to retrieve advance amounts for
Algodata Infosystems. The minimum advance
amount is then used to determine which titles to retrieve from the
Titles table.
</QUOTE
I don't understand why this references the "minimum advance". If you
run the subquery on its own, it returns the following values:

5000.0000
5000.0000
5000.0000
7000.0000
8000.0000
NULL

>From my limited understanding, the "ANY" keyword applies to at least
one value, but which one? How is this determined?

Any help gratefully received.

Edward
--
The reading group's reading group:
http://www.bookgroup.org.ukThe value to the left of the comparison operator (Advance) is compared
to each of the values returned by the subquery. If it matches at least
one of those values then the result is True. Think of it as a series of
comparions linked by OR. For example your query could be expanded to
the following, which is logically equivalent:

SELECT Title
FROM Titles
WHERE
(advance > 5000
OR advance > 5000
OR advance > 5000
OR advance > 7000
OR advance > 8000
OR advance > NULL)

--
David Portas
SQL Server MVP
--|||David Portas wrote:
> The value to the left of the comparison operator (Advance) is
compared
> to each of the values returned by the subquery. If it matches at
least
> one of those values then the result is True. Think of it as a series
of
> comparions linked by OR. For example your query could be expanded to
> the following, which is logically equivalent:
> SELECT Title
> FROM Titles
> WHERE
> (advance > 5000
> OR advance > 5000
> OR advance > 5000
> OR advance > 7000
> OR advance > 8000
> OR advance > NULL)

Thanks, David, that's extremely helpful. Am I right in thinking that
if I substitute the "ALL" keyword for the "ANY" keyword in the original
query, the expansion as above would be:

SELECT Title
FROM Titles
WHERE
(advance > 5000
AND advance > 5000
AND advance > 5000
AND advance > 7000
AND advance > 8000
AND advance > NULL)

If so, I'm back with the programme.

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk|||That's correct. I should also say that there is a subtle catch that if
the subquery is empty then ALL always returns True whereas the ANY
returns False. Try:

SELECT Title
FROM Titles
WHERE Advance > ANY
(
SELECT Advance
FROM Publishers INNER JOIN Titles
ON Titles.Pub_id = Publishers.Pub_id
AND 1=0)

SELECT Title
FROM Titles
WHERE Advance > ALL
(
SELECT Advance
FROM Publishers INNER JOIN Titles
ON Titles.Pub_id = Publishers.Pub_id
AND 1=0)

--
David Portas
SQL Server MVP
--|||David Portas wrote:
> That's correct. I should also say that there is a subtle catch that
if
> the subquery is empty then ALL always returns True whereas the ANY
> returns False. Try:
> SELECT Title
> FROM Titles
> WHERE Advance > ANY
> (
> SELECT Advance
> FROM Publishers INNER JOIN Titles
> ON Titles.Pub_id = Publishers.Pub_id
> AND 1=0)
> SELECT Title
> FROM Titles
> WHERE Advance > ALL
> (
> SELECT Advance
> FROM Publishers INNER JOIN Titles
> ON Titles.Pub_id = Publishers.Pub_id
> AND 1=0)

Interesting, but I've been using SQL without either ANY or ALL for
about ten years, so I guess I'll carry on without. However, the book
I'm studying has alerted me to CUBE and ROLLUP which I can see some
serious uses for.

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

Friday, 17 February 2012

configuring sql 6.5

**** Post for FREE via your newsreader at post.mcse.ms ****
Hi,
I can't see SQL 6.5 server installed on other computer. I am trying to
connect to it using SQL 2000, ODBC, ADO and none of this is helping. I
haven't experienced the same problems with SQL2000 installation. I have
installed it and all went ok. I do not change anyu network setting on this
computer and install SQL 6.5 and then i can't see this server. Maybe there
is some quick guide how to set SQL 6.5 as it seems to me that default
configuration do not work.
darius
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** mcse.ms - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.mcse.ms
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Darius wrote:

> I can't see SQL 6.5 server installed on other computer. I am trying to
> connect to it using SQL 2000, ODBC, ADO and none of this is helping. I
> haven't experienced the same problems with SQL2000 installation. I
> have installed it and all went ok. I do not change anyu network
> setting on this computer and install SQL 6.5 and then i can't see
> this server. Maybe there is some quick guide how to set SQL 6.5 as it
> seems to me that default configuration do not work.
Tibor already answered the EM question in your previous thread (please do
not create new threads if it is not needed). 7.0 or 2000 EM cannot work
against 6.5 or earlier. You need EM 6.5 for that.
Please post the connection string for ODBC/ADO approach.
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.|||**** Post for FREE via your newsreader at post.mcse.ms ****

> Tibor already answered the EM question in your previous thread (please do
> not create new threads if it is not needed). 7.0 or 2000 EM cannot work
> against 6.5 or earlier. You need EM 6.5 for that.
I know. I have asked one more question in last thread but I didnt get any
answers, so I created new thred. I've asked what do you mean EM 6.5? do you
mean new SQL 6.5 installation or only enterprise manager 6.5?
darius
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** mcse.ms - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.mcse.ms
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|||Darius wrote:
> I know. I have asked one more question in last thread but I didnt get
> any answers, so I created new thred. I've asked what do you mean EM
> 6.5? do you mean new SQL 6.5 installation or only enterprise manager
> 6.5?
Tibor answered that:
If you want to administer a 6.5 machine from another machine, you only need
to do a client install on that machine.
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.|||**** Post for FREE via your newsreader at post.mcse.ms ****
Hello,

> If you want to administer a 6.5 machine from another machine, you only
need
> to do a client install on that machine.
I still have some problems and I will be very thankful for any help. I can't
see my SQL 6.5 servers from any computer. I'm stuck I don't know where the
problem is. Intergrated WinNT security setting is ok. Please help.
Darius
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
*** mcse.ms - The #1 Usenet Newsgroup Service on The Planet! ***
http://www.mcse.ms
Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|||On Fri, 5 Mar 2004 08:54:34 +0100, "Darius" wrote:

>I still have some problems and I will be very thankful for any help. I can'
t
>see my SQL 6.5 servers from any computer. I'm stuck I don't know where the
>problem is. Intergrated WinNT security setting is ok. Please help.
G'day Darius,
How can't you see them? Or put another way, with what can't you see
them?
Can you ping the server that SQL 6.5 is on?
Can you connect to that server with SQL Query Analyser?
Can you create an ODBC DSN for this server and test it successfully?
cheers,
Ross.
--
"It's not the right time to be sober,
Now that the idiots have taken over" - NOFX|||In Integrated Security, a 6.5 server can only listen to Named Pipes. And on
MDAC 2.6 and later, a client that work against a pre-2000 server will only
connect using the top most protocol in Client Network Utility, which is IP
by default. On the client, using Client Network Utility: Either move IP to
the top or create an alias for the 6.5 server.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Darius" <darius.ram@.takas.lt> wrote in message
news:404823e8@.post.mcse.ms...
> **** Post for FREE via your newsreader at post.mcse.ms ****
> Hello,
>
> need
> I still have some problems and I will be very thankful for any help. I
can't
> see my SQL 6.5 servers from any computer. I'm stuck I don't know where the
> problem is. Intergrated WinNT security setting is ok. Please help.
> Darius
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> *** mcse.ms - The #1 Usenet Newsgroup Service on The Planet! ***
> http://www.mcse.ms
> Unlimited Download - 19 Seperate Servers - 90,000 groups - Uncensored
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=