标签:
CREATE TABLE EMPLOYEE_PAY_TBL ( EMP_ID VARCHAR(9) NOT NULL primary key, POSITION VARCHAR(15) NOT NULL, DATE_HIRE DATE, PAY_RATE DECIMAL(4,2), DATE_LAST_RAISE DATE, SALARY DECIMAL(8,2), BONUS DECIMAL(6,2), CONSTRAINT EMP_FK FOREIGN KEY (EMP_ID) REFERENCES EMPLOYEE_TBL (EMP_ID) );
ALTER TABLE EMPLOYEE_PAY_TBL ADD CONSTRAINT CHK_PAY_RATE CHECK ( PAY_RATE > 10.00 );
SELECT * FROM EMPLOYEE_PAY_TBL; +-----------+---------------+------------+----------+-----------------+----------+---------+ | EMP_ID | POSITION | DATE_HIRE | PAY_RATE | DATE_LAST_RAISE | SALARY | BONUS | +-----------+---------------+------------+----------+-----------------+----------+---------+ | 213764555 | SALES MANAGER | 2004-08-14 | NULL | 2009-08-01 | 30000.00 | 2000.00 | | 220984332 | SHIPPER | 2006-07-22 | 11.00 | 1999-07-01 | NULL | NULL | | 311549902 | MARKETING | 1999-05-23 | NULL | 2009-05-01 | 40000.00 | NULL | | 313782439 | SALSEMAN | 2007-06-28 | NULL | NULL | 20000.00 | 1000.00 | | 442346889 | TEAM LEADER | 2000-06-17 | 14.75 | 2009-06-01 | NULL | NULL | | 443679012 | SHIPPER | 2001-01-14 | 15.00 | 1999-01-01 | NULL | NULL | +-----------+---------------+------------+----------+-----------------+----------+---------+
DESCRIBE EMPLOYEE_PAY_TBL; +-----------------+--------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------------+--------------+------+-----+---------+-------+ | EMP_ID | varchar(9) | NO | PRI | NULL | | | POSITION | varchar(15) | NO | | NULL | | | DATE_HIRE | date | YES | | NULL | | | PAY_RATE | decimal(4,2) | YES | | NULL | | | DATE_LAST_RAISE | date | YES | | NULL | | | SALARY | decimal(8,2) | YES | | NULL | | | BONUS | decimal(6,2) | YES | | NULL | | +-----------------+--------------+------+-----+---------+-------+
标签:
原文地址:http://www.cnblogs.com/fatoland/p/4538086.html