Wednesday, November 21, 2007

Thanksgiving SQL Teaser COUNT

Here is a small simple Thanksgiving teaser. What do you think will the result be of the select count query?

USE tempdb
GO

CREATE TABLE Customer (CustomerID INT PRIMARY KEY)
INSERT Customer VALUES (1)
INSERT Customer VALUES (2)
INSERT Customer VALUES (3)
INSERT Customer VALUES (4)

SELECT COUNT(*) Customer

3 comments:

Anonymous said...

If you can't even write a select statement, you really shouldn't be inserting records.

The result should be that you get fired for being worthless.

Anonymous said...

Try running. If you run it without FROM you get 1 as a result. If you run it with FROM you get 4. I'm thinking that was the purpose. I don't understand why the result is different though.

YEVGENIY G said...

alias?