November 19, 2009 at 10:14 pm
This was easy one. You can find more about wildcard use with LIKE search condition at below mentioned link:
http://bhaveshgpatel.wordpress.com/2009/10/03/sql-server-select-statement-with-where-like-clause/
November 20, 2009 at 4:27 am
There are no start and end for that regular expression na... so the answer should be three..???
November 20, 2009 at 4:48 am
I took the approach that the answer was easy. Not a wise approach. Good subject.
Jamie
November 20, 2009 at 5:23 am
I got tripped up on the fact that the string didn't end with %. So I answered the question for 'Jo[^n]%' instead of 'Jo[^n]'. Oops.
-----
a haiku...
NULL is not zero
NULL is not an empty string
NULL is the unknown
November 20, 2009 at 6:10 am
I answered correctly but didn't get the point, the answer page tells me that the correct selection is '1' because 'Joe' is the only match (which is the fourth selection when I look at the list)
November 20, 2009 at 6:15 am
daniel.gardiner (11/20/2009)
I answered correctly but didn't get the point, the answer page tells me that the correct selection is '1' because 'Joe' is the only match (which is the fourth selection when I look at the list)
The query is pulling a count of matches, not the id value.
-----
a haiku...
NULL is not zero
NULL is not an empty string
NULL is the unknown
November 20, 2009 at 6:26 am
ronmoses (11/20/2009)
daniel.gardiner (11/20/2009)
I answered correctly but didn't get the point, the answer page tells me that the correct selection is '1' because 'Joe' is the only match (which is the fourth selection when I look at the list)The query is pulling a count of matches, not the id value.
D'oh! Focused on the regex and not enough on the sql.
November 20, 2009 at 6:29 am
ronmoses (11/20/2009)
I got tripped up on the fact that the string didn't end with %. So I answered the question for 'Jo[^n]%' instead of 'Jo[^n]'. Oops.
Thank you ron, I did the same thing, but got confused for a second and thought that I had been using this incorrectly the entire time, and that the brackets were somehow referring to any character, not just the third. Your response clarified it for me.
Good simple question, keeping us in the details. 😀
---------------------------------------------------------
How best to post your question[/url]
How to post performance problems[/url]
Tally Table:What it is and how it replaces a loop[/url]
"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
November 20, 2009 at 7:24 am
ronmoses (11/20/2009)
I got tripped up on the fact that the string didn't end with %. So I answered the question for 'Jo[^n]%' instead of 'Jo[^n]'. Oops.
Same mistake here...
November 20, 2009 at 7:39 am
does this change from SQL2000 to SQL2005/8? when i try this in my SQL2000 if i leave the % out of the select- i get zero rows. needless to say when I try the test question in my database only the ones that have an 'n' in the third position are dropped so the answer appears to be three. and according the MSDN site it says:
The following example uses the [^] operator to find all the people in the Contact table who have first names that start with Al and have a third letter that is not the letter a.
Copy Code USE AdventureWorks;
GO
SELECT FirstName, LastName
FROM Person.Contact
WHERE FirstName LIKE 'Al[^a]%'
ORDER BY FirstName;
not trying to be difficult- trying to understand what i am missing.. thanks
November 20, 2009 at 7:41 am
Now is that confirmed....
May i know what the answer is...???
If it is 3.... then atleast say thanks na.... 🙂
November 20, 2009 at 7:46 am
Good question; I had forgotten about all of the pattern matching built into LIKE. I'll have to try to use it more.
November 20, 2009 at 8:18 am
I almost slected 4 (Joe's ID) then I noticed the * and realized there was only one column in the answer. I had to go back and read the SQL again to catch the count() function. I have learned to think twice about my answers to these questions.
Good question.
November 20, 2009 at 9:29 am
rajaneeshk (11/20/2009)
Now is that confirmed....May i know what the answer is...???
If it is 3.... then atleast say thanks na.... 🙂
The answer is 1 - there is only one record which matches the LIKE clause.
Viewing 15 posts - 1 through 15 (of 21 total)
You must be logged in to reply to this topic. Login to reply