Table 17.1. Obtaining The System Date
DBMS               Function/Variable
Access               NOW()
DB2                  CURRENT_DATE
MySQL               CURRENT_DATE()
Oracle               SYSDATE
PostgreSQL           CURRENT_DATE
SQL Server           GETDATE()
Sybase               GETDATE()Using DEFAULT Instead of NULL Values :Many database developers use DEFAULT values instead of NULL columns, especially in columns that will be used in calculations or data groupings.
This statement creates the OrderItems table that contains the individual items that make up an order. (The order itself is stored in the Orders table.) The quantity column contains the quantity for each item in an order. In this example, adding the text DEFAULT 1 to the column description instructs the DBMS to use a quantity of 1 if no quantity is specified.
Default values are often used to store values in date or time stamp columns. For example, the system date can be used as a default date by specifying the function or variable used to refer to the system date. For example, MySQL users might specify DEFAULT CURRENT_DATE(), while Oracle users might specify DEFAULT SYSDATE, and SQL Server users might specify DEFAULT GETDATE(). Unfortunately, the command used to obtain the system date is different in just about every DBMS. Table 17.1 lists the syntax for some DBMSs. If yours is not listed here consult your DBMSs documentation.

解决方案 »

  1.   

    偶试试:
    译文如下:
    使用默认值替换NULL列:许多数据库开发人员使用默认值替换NULL列,尤其是那些用于计算和数据分组的列。这段代码创建了一个包含个别项的规则项表来实现一个规则(规则本事是储存在规则表中的。)在一个规则中数量列为每一个项目包含数量。在这个例子中,如果没有数量被指定的话,就在列中添加文本1用来描述数据库命令。默认值通常用于在日期或者时间标志列中储存值。比如,系统日期可以通过指定函数或变量来用做一个关于系统日期的默认值。例如,MYSQL使用者可能使用DEFAULT CURRENT_DATE(), 而ORACLES使用者可能使用DEFAULT SYSDATE,SQL Server的使用者使用的是DEFAULT GETDATE().因此,不同的数据库管理系统中得到系统日期的命令是有区别的。表17.1列出了一些数据库管理系统的语法。如果您的数据库管理系统的语法没有列出,请参考您的数据库帮助文档。硬着头皮翻完了,希望能给楼主有帮助