1、进入sqlplus(不区分大小写,除了特殊要大写的)
sqlplus system/yaoxiyao as sysdba
conn scott/yaoxiyao
2、创建一个表空间
(1)为orcl数据库创建一个永久性的表空间orcl1,区自动扩展,段采用自动管理方式
create tablespace orcl1 datafile 'D:\app\oradata\yao\data_1.dbf' size 2000M;
(2)为orcl数据库创建一个临时的表空间orcl2
create temporary tablespace orcl1 tempfile 'D:\app\oradata\yao\data_1.dbf' size 2000M
extent management local uniform size 100M;
删除表空间orcl1及其所有内容,同时删除其所对应的数据文件
DROP TABLESPACE orcl1 INCLUDING CONTENTS AND DATAFILES;
3、创建学生表,课程表,选课表
create table Student1(
sno number(6) constraint S_PK primary key,
sname varchar2(10) not null,
sex char(2),
sage number(6,2),
constraint S_CK2 check(sage between 18 and 60)
);
4、create table course(
cno number(10) primary key,
cname char(20) unique
);