October 28, 2015 at 10:33 pm
Correct Answer for this question is the query would return 3 rows
myid 2 and 3 have coffee with C in upper case
CREATE TABLE MyTextTable
(
myid INT
, mytext varchar(MAX)
);
GO
INSERT dbo.MyTextTable
( myid, mytext )
VALUES
( 1, 'A good coffee bean is important for brewing a good cup of coffee.' )
, ( 2, 'Coffee fuels the development process.' )
, ( 3, 'Coffee is beloved by everyone.' )
, ( 4, 'Most coffee brewers do not get hot enough.' )
, ( 5, 'People in the US tend to prefer coffee over tea' )
;
GO
This select would ignore the id 2 and 3 and return myid 1,4 and 5 as output
SELECT
myid
FROM
dbo.MyTextTable AS mtt
WHERE
mytext LIKE '%coffee %';
So correct answer is 3. unfortunately that is not in the option for this question
note collation is impacting the output
October 29, 2015 at 4:06 am
saurabhsharmadcsa (10/28/2015)
Correct Answer for this question is the query would return 3 rows
No it isn't, because the default collation for a SQL server install is for a non-case-sensitive one--under such a collation, 5 rows are returned. It should be pretty obvious that when your assumptions produce an answer that is not given as an option, the most likely explanation is that your assumptions are wrong.
October 29, 2015 at 4:10 am
depending on db collation, upper case is considered or ignored..
Thanks Steve.
October 29, 2015 at 9:37 am
Sean Lange (10/28/2015)
Roshan Oozeer (10/28/2015)
Correct answer is 5 not 4 ... I want my 2 points.... Thank youRoshan
You just got one of them. If you want points that badly you can have some of mine. Last I checked they are still useless.
Love your remark!
October 29, 2015 at 9:39 am
Steve Jones - SSC Editor (10/28/2015)
Apologies. 5 Rows are returned. The wrong box got checked.Awarding back points to everyone.
OMG. You made a mistake. The world is coming to an end. 😛
October 29, 2015 at 4:11 pm
Answer should be 5 but answer in your email (The ABCs of Database Creation (SQLServerCentral 10/29/2015)) is 4, which is wrong
October 31, 2015 at 3:16 pm
below86 (10/28/2015)
Sean Lange (10/28/2015)
Roshan Oozeer (10/28/2015)
Correct answer is 5 not 4 ... I want my 2 points.... Thank youRoshan
You just got one of them. If you want points that badly you can have some of mine. Last I checked they are still useless.
What? They are useless? I was hoping to trade them in for a free toaster. 🙂
Surely the points must be worth the equivalent of a washer/dryer combo.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
October 31, 2015 at 3:17 pm
Steve Jones - SSC Editor (10/28/2015)
Apologies. 5 Rows are returned. The wrong box got checked.Awarding back points to everyone.
Ah shucks.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
November 2, 2015 at 6:19 am
Rushed this in playing catchup. Saw " coffee." in row 1 and thought "no space after so not that one" which would have been right if the previous "coffee " in the sentence didn't exist.
Sucker!!! (referring to myself)
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
November 5, 2015 at 8:18 am
Thanks for the great question, Steve (even if you did flub the answer).
December 22, 2015 at 9:39 am
Excellent question Steve except that it is depending if the language is case sensitive or not.
I remembered a similar question on a MSDN forum and the explanation was : be careful with the CaseSensitive facet on the database level ( I set it to false to mime the american behaviour to avoid any problem with the English speaking posters ).So it was easy to find the good choice ( which was depending of Steve's country ).
But as my understanding of the English language is not full ( and worst when I am writing ) , maybe , I have been wrong...
To be sure that I will not forget , happy Christmas for all of yours....
Viewing 11 posts - 76 through 85 (of 85 total)
You must be logged in to reply to this topic. Login to reply