题目:创建数据表 create table PRODUCT ( id NUMBER not null, --主键 pcode VARCHAR2(20) not null, --商品编号 pname VARCHAR2(20), --商品名称 inprice NUMBER(7,2), --进价 outprice NUMBER(7,2), --售价 toma VARCHAR2(20), --管理员名称 lastcou NUMBER, --剩余数量 ptype VARCHAR2(5), --商品类型 mark NUMBER, --有效标志 createtime DATE --生产日期 ); alter table PRODUCT ADD CONSTRAINT pk____product primary key (ID); 插入数据 insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (1, 'f-qq45', '香蕉', 2.8, 4, '张三', 12, 'a', 1, to____date('05-05-2017', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (2, 'f-56tt', '苹果', 3.4, 5, '张三', 33, 'a', 1, to____date('16-06-2016', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (3, 'f-332', '梨', 2.7, 4, '张三', 76, 'a', 1, to____date('23-09-2016', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (4, 'f-20', '猪肉', 14, 16, '张三', 56, 'b', 1, to____date('31-12-2013', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (5, 'f-qq46', '圆珠笔', 3, 5, '王五', 55, 'e', 1, to____date('14-09-2016', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (6, 'f-57tt', '樱桃', 8, null, '王五', 12, 'a', 1, to____date('22-05-2006', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (7, 'f-292', '三文鱼', 5, 8, '王五', 23, 'b', 1, to____date('31-07-2001', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (8, 'f-604', '螺丝刀', 12, 15, '王五', 72, 'c', 1, to____date('24-02-2013', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (9, 'f-qq47', '扳手', 14, 19, '王五', 90, 'c', 1, to____date('14-05-2015', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (10, 'f-58tt', '钳子', 10, 13, '张三', 97, 'c', 1, to____date('28-03-2012', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (11, 'f-916', '矿泉水', 2.5, 3, '李四', 44, 'd', 1, to____date('21-07-2012', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (12, 'f-1228', '杏仁露', 4, 5, '李四', 38, 'd', 1, to____date('22-02-2013', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (13, 'f-59tt', '钢笔', null, 43, '李四', 22, 'e', 1, to____date('30-09-2013', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (14, 'f-1540', '铅笔', .5, .8, '赵六', 72, 'e', 1, to____date('14-05-2017', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (15, 'f-1852', '大马哈鱼', 1.5, 2, '赵六', 76, 'b', 1, to____date('17-05-2012', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (16, 'f-2164', '鸡蛋', 2.7, 4, '赵六', 56, 'b', 1, to____date('14-09-2010', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (17, 'p-123h', '雪碧', 2, 3, '王五', 50, 'd', 1, to____date('01-05-2017', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (18, 'p-111h', '冰红茶', 2, 3, '王五', 40, 'd', 1, to____date('18-05-2017', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (19, 'p-18-h', '可乐', 2, 3, '王五', 30, 'd', 1, to____date('09-05-2017', 'dd-mm-yyyy')); insert into PRODUCT (id, pcode, pname, inprice, outprice, toma, lastcou, ptype, mark, createtime) values (20, 'f-qq46', '圆珠笔', 3, 5, '王五', 55, 'e', 1, to____date('14-09-2016', 'dd-mm-yyyy')); commit; 为商品名称添加一个非空约束, 为剩余数量添加一个检查约束(剩余数量 >= 5)
答案:评论后可见此内容
推荐使用我们的公众号搜索题目,题目更全,检索更方便。支持语音、图片、文字等多种搜索方式。