Friday, February 15, 2013

Date Literals

Date Literals

DATE literals are specified in the ANSI standard as a way of representing date con- stants, and take the following form:
DATE 'YYYY-MM-DD' Note that the ANSI date literal doesn’t contain the time information. We also can’t specify a format. If we want to specify a date literal using this ANSI syntax, we must always use the YYYY-MM-DD date format.

The following example illustrates the use of a DATE literal in a SQL statement:



INSERT INTO EMPLOYEE (EMP_ID, FNAME, LNAME, DEPT_ID, MANAGER_EMP_ID, SALARY, HIRE_DATE) VALUES (2304, 'John', 'Smith', 20, 1258, 20000, DATE '1999-10-22');

No comments:

Post a Comment