数据库

-- Create table
create table T_STUDENT
(
  sno       VARCHAR2(3) not null,
  sname     VARCHAR2(8) not null,
  ssex      VARCHAR2(2) not null,
  sbirthday DATE,
  class     VARCHAR2(5)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255;
-- Add comments to the table 
comment on table T_STUDENT
  is '学生表';
-- Add comments to the columns 
comment on column T_STUDENT.sno
  is '学号(主键)';
comment on column T_STUDENT.sname
  is '学生姓名';
comment on column T_STUDENT.ssex
  is '学生性别';
comment on column T_STUDENT.sbirthday
  is '学生出生年月';
comment on column T_STUDENT.class
  is '学生所在班级';
-- Create table
create table COURSE
(
  cno   VARCHAR2(5) not null,
  cname VARCHAR2(10) not null,
  tno   VARCHAR2(3) not null
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255;
-- Add comments to the table 
comment on table COURSE
  is '课程表';
-- Add comments to the columns 
comment on column COURSE.cno
  is '课程号(主键)';
comment on column COURSE.cname
  is '课程名称';
comment on column COURSE.tno
  is '教工编号(外键)';
-- Create table
create table T_SCORE
(
  sno    VARCHAR2(3) not null,
  cno    VARCHAR2(5) not null,
  degree NUMBER(4,1)
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255;
-- Add comments to the table 
comment on table T_SCORE
  is '成绩表';
-- Add comments to the columns 
comment on column T_SCORE.sno
  is '学号(外键)';
comment on column T_SCORE.cno
  is '课程号(外键)';
comment on column T_SCORE.degree
  is '成绩';
-- Create table
create table TEACHER
(
  tno       VARCHAR2(3) not null,
  tname     VARCHAR2(4) not null,
  tsex      VARCHAR2(2) not null,
  tbirthday DATE,
  prof      VARCHAR2(6),
  depart    VARCHAR2(10) not null
)
tablespace USERS
  pctfree 10
  initrans 1
  maxtrans 255;
-- Add comments to the table 
comment on table TEACHER
  is '教师表';
-- Add comments to the columns 
comment on column TEACHER.tno
  is '教工编号(主键)';
comment on column TEACHER.tname
  is '教工姓名';
comment on column TEACHER.tsex
  is '教工性别';
comment on column TEACHER.tbirthday
  is '教工出生年月';
comment on column TEACHER.prof
  is '职称';
comment on column TEACHER.depart
  is '教工所在部门';

 

原文地址:https://www.cnblogs.com/jskbk/p/5567277.html