新建下載權限記錄表 DOWNLOADPOPE_TAB 字段:id、用戶id、有下載權限的下載中心分類表id、有上傳權限的下載中心分類表id ID(int)、userid(int)、downid(string)、upid(string) 執行語句
//1創建
CREATE TABLE DOWNLOADPOPE_TAB
(
ID INT NOT NULL,
USERID INT NOT NULL,
DOWNID VARCHAR(60),
UPID VARCHAR(60),
CONSTRAINT DOWNLOADPOPE_TAB PRIMARY KEY (ID)
);
//2創建自動增長序列
CREATE SEQUENCE DOWNLOADPOPE_TAB_Sequence
INCREMENT BY 1
START WITH 1
NOMAXVALUE
NOCYCLE
CACHE 10;
//3創建觸發器
CREATE TRIGGER DOWNLOADPOPE_TAB BEFORE
insert ON DOWNLOADPOPE_TAB FOR EACH ROW
begin
select DOWNLOADPOPE_TAB_Sequence.nextval into:New.id from dual; end;
//4.提交
commit;
//5.插入
INSERT INTO DOWNLOADPOPE_TAB(userid,downid,upid)VALUES(100123,'Oracle sql','54.70');
//6.查詢
select * from jxpost.DOWNLOADPOPE_TAB
//7.刪除數據
DELETE DOWNLOADPOPE_TAB where id=1
//8.刪除表
DROP TABLE DOWNLOADPOPE_TAB