Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««1234»»»

DATETIME Puzzle Expand / Collapse
Author
Message
Posted Thursday, November 17, 2011 7:16 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Tuesday, August 26, 2014 8:32 AM
Points: 561, Visits: 731
I didn't see anything as to what question we were supposed to answer. Luckily I guessed correctly that we were supposed to select how many rows were returned by the query.

Tony
------------------------------------
Are you suggesting coconuts migrate?
Post #1207498
Posted Thursday, November 17, 2011 7:50 AM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, May 9, 2014 12:47 AM
Points: 3,448, Visits: 4,407
tabinsc (11/17/2011)
I didn't see anything as to what question we were supposed to answer. Luckily I guessed correctly that we were supposed to select how many rows were returned by the query.

The question is written in large letters, although with a typo ("may" instead of "many")
How may rows will be returned by following query?
Post #1207532
Posted Thursday, November 17, 2011 8:11 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 10:20 AM
Points: 1,740, Visits: 6,366
A very easy question, unless you temporarily forget how to count
Post #1207554
Posted Thursday, November 17, 2011 8:13 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, August 26, 2014 6:02 PM
Points: 2,818, Visits: 2,560
Good question, thanks.
Post #1207557
Posted Thursday, November 17, 2011 8:22 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 12:41 PM
Points: 324, Visits: 188
sknox (11/17/2011)
I've seen this crop up enough time on the forums to see why it rates 2 points.
While the answer is super-easy if you know DATETIME, this question highlights one of the easiest mistakes for a beginner to make, and one that has serious real-world implications.


Hear! Hear!
Post #1207574
Posted Thursday, November 17, 2011 9:14 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Friday, August 22, 2014 8:50 AM
Points: 4,425, Visits: 3,417
THis was a really simple one - thanks!
Post #1207618
Posted Thursday, November 17, 2011 9:20 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 11:04 AM
Points: 1,256, Visits: 13,552
good question!!!


rfr.ferrari
DBA - SQL Server 2008
MCITP | MCTS

remember is live or suffer twice!
Post #1207624
Posted Thursday, November 17, 2011 9:58 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 31, 2013 8:53 AM
Points: 1,176, Visits: 778
nice easy question today - tks
Post #1207683
Posted Thursday, November 17, 2011 10:56 AM


Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, August 25, 2014 2:58 AM
Points: 797, Visits: 1,572
There are good reasons to avoid using BETWEEN when comparing two datetimes. Particularly in the example the answer uses. You should be using the various symbols for GREATER THAN and LESS THAN.



One of the symptoms of an approaching nervous breakdown is the belief that one's work is terribly important.
Bertrand Russell
Post #1207757
Posted Thursday, November 17, 2011 12:49 PM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, May 28, 2014 12:41 PM
Points: 324, Visits: 188
GPO (11/17/2011)
There are good reasons to avoid using BETWEEN when comparing two datetimes. Particularly in the example the answer uses. You should be using the various symbols for GREATER THAN and LESS THAN.

No, I don't think you can (if not reverting to subqueries...)

The "AND" operator will check against the date-columns seperately - not simultaneously which in the case with "BETWEEN".
Using GREATER THAN and LESS THAN in the above question would actually return all the records.

(Sorry, being a bit rusty I'm not entirely sure this is correct, but I've been there, done that and bought the friggin' t-shirt...)
Post #1207840
« Prev Topic | Next Topic »

Add to briefcase ««1234»»»

Permissions Expand / Collapse