SQL Query of the Day #301220131000

Query:

CREATE TABLE EMPLOYEES (
enumber int NOT NULL,
lname char(30) NOT NULL,
fname char(30) NOT NULL,
hire_date datetime NOT NULL)
GO
INSERT INTO EMPLOYEES
VALUES(1,'Bot','Cam','1988-11-24 09:29:01.303')
GO
INSERT INTO EMPLOYEES
VALUES(2,'Sy','Gyp','1988-11-24 09:29:02.303')
GO
INSERT INTO EMPLOYEES
VALUES(3,'Servo','Tom','1988-11-24 09:29:03.303')
GO
INSERT INTO EMPLOYEES
VALUES(4,'Robot','Crow T.','1988-11-24 09:29:04.303')
GO

Function: Create sample data so we can run subsequent queries on datetime data … instead of just writing queries on tables that don’t exist, like a certain self-proclaimed T-SQL guru.

Source: Me. Although I wrote this so that I could run the datetime queries in The Guru’s Guide to Transact-SQL, by Ken Henderson … who neglected to include any DDL for the EMPLOYEE table. (Yeah, I know my table’s named differently. Sue me.)

Comments: There are four employees at this organization. All of them are robots, and all were hired within one second of each other, at the moment of roll call. If you don’t get why this is awesome, you are a lot less happy than you could be. I hope that you realize why … in the not too distant future. Maybe next Sunday, A.D.

Leave a Comment

Filed under Uncategorized

Leave a Reply