使用日期-SQL语言基础

时间:2024-05-15 13:24:53
【文件属性】:

文件名称:使用日期-SQL语言基础

文件大小:5.26MB

文件格式:PPT

更新时间:2024-05-15 13:24:53

SQL 基础

使用日期 * Oracle 以一种内部的格式来保存日期: 世纪,年,月,日,小时,分钟,秒. 缺省的格式:DD-MON-YY.例如:23-JAN-02 SYSDATE 是一个返回日期和时间的函数. DUAL 是一个显示 SYSDATE的虚拟表. * Oracle Date Format Oracle stores dates in an internal numeric format, representing the century, year, month, day, hours, minutes, and seconds. The default display and input format for any date is DD-MON-YY. Valid Oracle dates are between January 1, 4712 B.C., and December 31, 9999 A.D. SYSDATE SYSDATE is a date function that returns the current date and time. You can use SYSDATE just as you would use any other column name. For example, you can display the current date by selecting SYSDATE from a table. It is customary to select SYSDATE from a dummy table called DUAL. DUAL The DUAL table is owned by the user SYS and can be accessed by all users. It contains one column, DUMMY, and one row with the value X. The DUAL table is useful when you want to return a value once only—for instance, the value of a constant, pseudocolumn, or expression that is not derived from a table with user data. The DUAL table is generally used for SELECT clause syntax completeness, because both SELECT and FROM clauses are mandatory, and several calculations do not need to select from actual tables. Example Display the current date using the DUAL table. SQL> SELECT SYSDATE 2 FROM DUAL;


网友评论