-- Create table
create table STUDENT
(
sno VARCHAR2(3) not null,
sname VARCHAR2(8) not null,
ssex VARCHAR2(3) not null,
sbirthday DATE,
class VARCHAR2(5)
)
tablespace TEST.DBF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table STUDENT
is '学生表';
-- Add comments to the columns
comment on column STUDENT.sno
is '学号(主键)';
comment on column STUDENT.sname
is '学生姓名';
comment on column STUDENT.ssex
is '学生性别';
comment on column STUDENT.sbirthday
is '学生出生年月';
comment on column STUDENT.class
is '学生所在班级';

添加数据:

课程表:

 -- Create table
create table COURSE
(
cno VARCHAR2(5) not null,
cname VARCHAR2(20) not null,
tno VARCHAR2(3) not null
)
tablespace TEST.DBF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- 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 SCORE
(
sno VARCHAR2(3) not null,
cno VARCHAR2(5) not null,
degree NUMBER(4,1) not null
)
tablespace TEST.DBF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Add comments to the table
comment on table SCORE
is '成绩表';
-- Add comments to the columns
comment on column SCORE.sno
is '学号(外键)';
comment on column SCORE.cno
is '课程号(外键)';
comment on column SCORE.degree
is '成绩';

添加数据:

教师表:

 -- Create table
create table TEACHER
(
tno VARCHAR2(3) not null,
tname VARCHAR2(10) not null,
tsex VARCHAR2(3) not null,
tbirthday DATE,
prof VARCHAR2(9),
depart VARCHAR2(20) not null
)
tablespace TEST.DBF
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- 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 '教工所在部门';

添加数据:

Oracle 建表的更多相关文章

  1. PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大、小写

    原文:PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大.小写 若要将 CDM 中将 Entity的标识符都设为指定的大小写,则可以这么设定: 打开cdm的情况下,进入T ...

  2. 5.oracle建表的时候同时创建主键,外键,注释,约束,索引

    5.oracle建表的时候同时创建主键,外键,注释,约束,索引 1 --主键 )); ) ,constraint aba_pr primary key(id,name1)); --外键 )); --复 ...

  3. oracle 建表时显示ORA-00984: 列在此处不允许

      oracle 建表时显示ORA-00984: 列在此处不允许 CreationTime--2018年7月19日16点10分 Author:Marydon 1.情景展示 使用plsql建表时,报错 ...

  4. oracle 建表时显示ORA-00904无效的标识符

      oracle 建表时显示ORA-00904无效的标识符 CreationTime--2018年7月19日16点03分 Author:Marydon 1.情景展示 使用plsql建表时,报错 字段展 ...

  5. oracle 建表 主键自增序列/////

    oracle 建表 主键自增序列 (2011-10-12 11:59:22) 转载▼ 标签: 杂谈 分类: oracle SQL> create table sms_activity(  2   ...

  6. Oracle建表提示SQL 错误: ORA-00904: : 标识符无效

    Oracle建表提示: 错误报告:SQL 错误: ORA-00904: : 标识符无效00904. 00000 -  "%s: invalid identifier"*Cause: ...

  7. Oracle建表

    1.oracle数据库中的多种数据结构: 1.表结构            存储数据 2.视图 一张表或多张表中数据的字节 3.sequence 主要用来生成主键值 4.index 提高检索性能 我们 ...

  8. oracle建表并设置ID为自动增长

    CREATE TABLESPACE shopping DATAFILE 'D:\oracle\mypc\oradata\orcl\shopping.dbf' SIZE 20M AUTOEXTEND O ...

  9. SQL SERVER 生成ORACLE建表脚本

    /****** Object: StoredProcedure [dbo].[GET_TableScript_ORACLE] Script Date: 06/15/2012 13:07:16 **** ...

  10. Oracle 建表常用数据类型的详解

    创建表时,必须为表的各个列指定数据类型.如果实际的数据与该列的数据类型不相匹配,则数据库会拒绝保存.如为学生指定出生日期为“1980-13-31”. 在Oracle中,常见的数据类型有: 字符串:字符 ...

随机推荐

  1. GitHub客户端和Shell的基本操作和理解

    GitHub客户端和Shell指令的简单实用 客户端操作, web端操作, shell指令操作. 掌握了这三种操作,基本上就可以很好的运用gitHub了. 创建项目, 可以通过web端进行创建. 可以 ...

  2. IntelliJ IDEA中JAVA连接MYSQL

    1.下载mysql包 2.项目中引入mysql包 3.连接数据库,查询结果 看jdbc数据库连接类 package Facade; import java.sql.*; /** * Created b ...

  3. ThinkPHP5.0框架开发--第8章 TP5.0 模型

    ThinkPHP5.0框架开发--第8章 TP5.0 模型 第8章 TP5.0 模型 ================================================= 今日学习 1. ...

  4. 性能监控之监控SQL语句

    分析表 analyze table tablename compute statistics for all indexes; analyze table tablename compute stat ...

  5. requireJS实现原理分析

    下面requireJS实现的基本思路  项目地址https://github.com/WangMaoling/require var require = (function(){ //框架版本基本信息 ...

  6. C++提高速度

  7. Sql Server 2012数据库的安装【自己一点一点敲的】

    Sql Server 2012数据库的安装 1.到微软官网上下载 下载链接为:https://www.microsoft.com/zh-cn/download/details.aspx?id=2906 ...

  8. 【原创】Spring连接、事务代码分析

    1.JdbcTemplate     当不使用事务时,jdbcTemplate的模板类,通过     Connection con = DataSourceUtils.getConnection(ge ...

  9. HDU 1892 See you~ 【 二维树状数组 】

    题意:二维的树状数组注意的有三个地方,输入进去的坐标都加1,防止lowbit(0) + 0造成死循环还有就是询问矩形面积的时候,输入进去的x1,x2,y1,y2,可能不是正对角线,要转化成正对角线 初 ...

  10. 路飞学城-Python开发-第一章

    # 基础需求: # 让用户输入用户名密码 # 认证成功后显示欢迎信息 # 输错三次后退出程序 username = 'pandaboy' password = ' def Login(username ...