51Testing软件测试论坛

标题: 求助高手 [打印本页]

作者: liangke    时间: 2005-1-27 09:08
标题: 求助高手
CREATE TABLE DB2ADMIN.SALES
(CUSTOMER_ID INT NOT NULL, ITEM_ID INT NOT NULL,
SALE_QUANTITY SMALLINT NOT NULL, SALE_DATE DATE NOT NULL);
INSERT INTO SALES
SELECT
SYSFUN.RAND()*500 + 1 AS CUSTOMER_ID,
SYSFUN.RAND()*100 + 1 AS ITEM_ID,
1 + SYSFUN.RAND()*10 AS SALE_QUANTITY,
DATE('01/01/2003') + (SYSFUN.RAND()*200) DAYS AS SALE_DATE
FROM SYSCAT.COLUMNS;



那位高手能帮兄弟解释一下上面一段语句的意思,如何使用?
万分感谢!!!
作者: Nio    时间: 2005-1-27 13:33
Originally posted by liangke at 2005-1-27 09:08 AM:
CREATE TABLE DB2ADMIN.SALES
(CUSTOMER_ID INT NOT NULL, ITEM_ID INT NOT NULL,
SALE_QUANTITY SMALLINT NOT NULL, SALE_DATE DATE NOT NULL);
INSERT INTO SALES
SELECT
SYSFUN.RAND()*500 + 1 AS CU ...



这是一段SQL语句。
CREATE TABLE DB2ADMIN.SALES
(CUSTOMER_ID INT NOT NULL, ITEM_ID INT NOT NULL,
SALE_QUANTITY SMALLINT NOT NULL, SALE_DATE DATE NOT NULL);
INSERT INTO SALES
——创建一个名为 DB2ADMIN.SALES的表,并将其插入到SALES数据库中。

SELECT
SYSFUN.RAND()*500 + 1 AS CUSTOMER_ID,
SYSFUN.RAND()*100 + 1 AS ITEM_ID,
1 + SYSFUN.RAND()*10 AS SALE_QUANTITY,
DATE('01/01/2003') + (SYSFUN.RAND()*200) DAYS AS SALE_DATE
FROM SYSCAT.COLUMNS;
——从SYSCAT.COLUMNS表中选取相应字段的数据处理后作为DB2ADMIN.SALES相应字段的数据。

这段SQL语句从语法上是这样的,不过实际运行时……俺就不晓得啦。
作者: liangke    时间: 2005-1-28 15:29
标题: 多谢!
谢谢版主!
谢谢战友!




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2