创建一个名为stu_seq序列。要求序列号的起始值为201702001,按升序每次增加1,不缓存,不循环

创建一个名为stu_seq序列。要求序列号的起始值为201702001,按升序每次增加1,不缓存,不循环。

	create sequence stu_seq
•	     increment by 1
•	     start with 201702001
•	     nomaxvalue
•	     nocycle 
•	     nocache;

• 在myuser表空间创建一个学生信息表student,该表包括以下字段
• Column • Type
• Sno • Number(9)
• Sname • Varchar2(20)
• Sex • Char(2)
• Age • Number(3)

create tablespace myuser datafile 'd:\wb01.dbf' size 10m;       
create  table student3(
  sno number(9),
  sname varchar2(20), 
  sex char(2), 
  age number(3)
) tablespace myuser;

• 为学生表创建名为stu的公有同义词

create public synonym stu for student;

• 使用伪列向学生信息表中插入两条记录

•	insert into student values(stu_seq.nextval,'li','N','20');
•	insert into student values(stu_seq.nextval,'wi','N','20');
发布了105 篇原创文章 · 获赞 37 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/qq_43615815/article/details/102897653