forked from zhanglei-workspace/shopping-management-system
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
152 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
--��Ʒ�����01-- | ||
create table classify | ||
( | ||
gid number(11) primary key, | ||
gname varchar2(200) not null | ||
); | ||
|
||
--Ϊclassify������gid����Ψһ ����-- | ||
create sequence classify_seq | ||
start with 1 | ||
increment by 1 | ||
minvalue 1 | ||
maxvalue 10000 | ||
nocycle | ||
cache 10; | ||
|
||
--����������-- | ||
create trigger classify_trigger | ||
before insert on classify | ||
for each row | ||
begin | ||
select classify_seq.nextval into :new.gid from dual; | ||
end; | ||
|
||
|
||
|
||
--commodity�� ������Ʒ��Ϣ02-- | ||
|
||
create table commodity | ||
( | ||
commodity_number varchar2(255) primary key, | ||
commodity_name varchar(255) not null, | ||
commodity_made varchar2(255), | ||
commodity_price NUMBER(18,2) not null, | ||
commodity_balance NUMBER(7) not null, | ||
commodity_pic varchar2(255)not null, | ||
commodity_id number(11) references classify(gid) not null | ||
); | ||
|
||
--Ϊcommodity������gid����Ψһ ����-- | ||
create sequence commodity_seq | ||
start with 1 | ||
increment by 1 | ||
minvalue 1 | ||
maxvalue 100000 | ||
nocycle | ||
cache 10; | ||
|
||
--����������-- | ||
create trigger commodity_trigger | ||
before insert on commodity | ||
for each row | ||
begin | ||
select commodity_seq.nextval into :new.commodity_number from dual; | ||
end; | ||
|
||
|
||
--orderForm������03 -- | ||
create table orderForm | ||
( | ||
id number(10) primary key, | ||
commodity_name varchar2(255) not null, | ||
commodity_price NUMBER(18,2) not null, | ||
orderDate DATE DEFAULT SYSDATE NOT NULL, | ||
sum number(18,2) | ||
); | ||
|
||
--��������-- | ||
CREATE SEQUENCE orderForm_seq | ||
START WITH 1 | ||
INCREMENT BY 1 | ||
MINVALUE 1 | ||
MAXVALUE 100000 | ||
NOCYCLE | ||
CACHE 10; | ||
|
||
--������-- | ||
CREATE TRIGGER orderForm_trigger | ||
BEFORE INSERT ON orderForm | ||
FOR EACH ROW | ||
BEGIN | ||
SELECT orderForm_seq.nextval into :new.id FROM dual; | ||
END; | ||
|
||
--�û���vip | ||
create table vip | ||
( | ||
username varchar2(255) primary key, | ||
userpass varchar2(255) not null, | ||
phone varchar2(255), | ||
address varchar2(255), | ||
realname varchar2(255) | ||
); | ||
|
||
commit; | ||
|
||
INSERT INTO vip(username,userpass,phone,address,realname) VALUES('lyons','123456','15853123329','����','���') | ||
|
||
select * from commodity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
|
||
-- insert into classify | ||
insert into classify(gname) values('鞋子'); | ||
insert into classify(gname) values('衬衫'); | ||
insert into classify(gname) values('手机'); | ||
insert into classify(gname) values('电子产品'); | ||
commit; | ||
|
||
drop trigger classify_tigger | ||
-- insert into commodity | ||
|
||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('沃特篮球鞋', '佛山', 180, 500, '001.jpg',1); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('安踏运动鞋', '福州', 120, 800, '002.jpg',1); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('耐克运动鞋', '广州', 500, 1000, '003.jpg',1); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('阿迪达斯T血衫', '上海', 388,600,'004.jpg',2); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('李宁文化衫', '广州', 180, 900, '005.jpg',2); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('小米3', '北京', 1999, 3000, '006.jpg',3); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('小米2S', '北京', 1299, 1000, '007.jpg',3); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('thinkpad笔记本', '北京', 6999, 500, '008.jpg',4); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('dell笔记本', '北京', 3900, 500, '009.jpg',4); | ||
INSERT INTO commodity(commodity_name,commodity_made,commodity_price,commodity_balance,commodity_pic,commodity_id) VALUES ('ipad5', '北京', 5900, 500, '010.jpg',4); | ||
|
||
--Drop all table 注意删除顺序-- | ||
drop trigger commodity_trigger; | ||
commit; | ||
drop sequence commodity_seq; | ||
commit; | ||
drop table commodity; | ||
commit; | ||
|
||
drop trigger classify_trigger; | ||
commit; | ||
drop sequence classify_seq; | ||
commit; | ||
drop table classify; | ||
commit; | ||
|
||
drop trigger orderForm_trigger; | ||
commit; | ||
drop sequence orderForm_seq; | ||
commit; | ||
drop table orderForm ; | ||
commit; | ||
|
||
|