1.SQL分类:
a1.数据定义语言(DDL)
CREATE
ALTER
DROP
TRUNCATE
a2.数据操纵语言(DML)
INSERT
UPDATE
DELETE
SELECT
a3.事务控制语言(TCL)
COMMIT
SAVEPOINT
ROLLBACK
a4.数据控制语言(DCL)
GRANT
REVOKE
2. oracle中的序列
--创建序列
语法:
CREATE SEQUENCE sq_name
[start with n][increment by n] [maxvalue n|nomaxvalue]
[cycle|nocycle][cache n | nocache] ;
例1:创建一个从1开始,每次自增1的序列
CREATE SEQUENCE stu_seq
例2:
CREATE SEQUENCE stu_seq2
start with 100
increment by 1
maxvalue 99999999
nocycle
cache 10
3.使用序列
序列名.nextval --从序列中取下一个值来使用
序列名.currval --从序列中取当前值
例:select stu_seq.nextval from dual;
例:select stu_seq.currval from dual;
4.修改序列
除了序列的启动值不能修改,其它属性均可修改
例:
alter sequence stu_seq2
increment by 2maxvalue 99999
5.删除序列
语法:drop sequence 序列名
例: drop sequence stu_seq2