Oracle 建表
-- 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 建表的更多相关文章
- PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大、小写
原文:PowerDesigner生成的ORACLE 建表脚本中去掉对象的双引号,设置大.小写 若要将 CDM 中将 Entity的标识符都设为指定的大小写,则可以这么设定: 打开cdm的情况下,进入T ...
- 5.oracle建表的时候同时创建主键,外键,注释,约束,索引
5.oracle建表的时候同时创建主键,外键,注释,约束,索引 1 --主键 )); ) ,constraint aba_pr primary key(id,name1)); --外键 )); --复 ...
- oracle 建表时显示ORA-00984: 列在此处不允许
oracle 建表时显示ORA-00984: 列在此处不允许 CreationTime--2018年7月19日16点10分 Author:Marydon 1.情景展示 使用plsql建表时,报错 ...
- oracle 建表时显示ORA-00904无效的标识符
oracle 建表时显示ORA-00904无效的标识符 CreationTime--2018年7月19日16点03分 Author:Marydon 1.情景展示 使用plsql建表时,报错 字段展 ...
- oracle 建表 主键自增序列/////
oracle 建表 主键自增序列 (2011-10-12 11:59:22) 转载▼ 标签: 杂谈 分类: oracle SQL> create table sms_activity( 2 ...
- Oracle建表提示SQL 错误: ORA-00904: : 标识符无效
Oracle建表提示: 错误报告:SQL 错误: ORA-00904: : 标识符无效00904. 00000 - "%s: invalid identifier"*Cause: ...
- Oracle建表
1.oracle数据库中的多种数据结构: 1.表结构 存储数据 2.视图 一张表或多张表中数据的字节 3.sequence 主要用来生成主键值 4.index 提高检索性能 我们 ...
- oracle建表并设置ID为自动增长
CREATE TABLESPACE shopping DATAFILE 'D:\oracle\mypc\oradata\orcl\shopping.dbf' SIZE 20M AUTOEXTEND O ...
- SQL SERVER 生成ORACLE建表脚本
/****** Object: StoredProcedure [dbo].[GET_TableScript_ORACLE] Script Date: 06/15/2012 13:07:16 **** ...
- Oracle 建表常用数据类型的详解
创建表时,必须为表的各个列指定数据类型.如果实际的数据与该列的数据类型不相匹配,则数据库会拒绝保存.如为学生指定出生日期为“1980-13-31”. 在Oracle中,常见的数据类型有: 字符串:字符 ...
随机推荐
- Oracle SGA具体解释
SGA(SYSTEM Global Area )系统全局区 l 数据快速缓存 在Oracle进行数据处理的过程中,代价最昂贵的就是物理 I/O操作了.相同的数据从内存中得到要比从磁盘上读取快的多. 因 ...
- int *p,cons int *p,int const *p,int * const p,const int * const p,int const * const p的差别
加有constkeyword的几种情况的辨析 const修饰的代码 含义(特点) 等价性 int *p = # 1. 能够读自己 2. 能够通过*p改自己 ...
- java.lang.ClassNotFoundException: org.jaxen.JaxenException
java.lang.ClassNotFoundException: org.jaxen.JaxenException java.lang.ClassNotFoundException: org.jax ...
- C++ Primer Plus的若干收获--(三)
有时候怀疑真是怀疑自己走的路究竟是不是正确的.作为一个土生土长数学系学生,却对数学毫无兴趣,没事的时候就喜欢躲在图书馆看看有关计算机的书.有时候期末考试时候会挂个一两门的数学专业课,有时候真希望数学课 ...
- "singleTask"模式 切换到新的栈中
本文截取了网络资源的结论部分 对singletask 启动模式做笔记记录. 尽管SubActivity的launchMode被设置为"singleTask"模式,可是它并不像官方文 ...
- [JZOJ 4307] [NOIP2015模拟11.3晚] 喝喝喝 解题报告
题目链接: http://172.16.0.132/senior/#main/show/4307 题目: 解题报告: 题目询问我们没出现坏对的连续区间个数 我们考虑从左到有枚举右端点$r$,判断$a[ ...
- zookeeper的选举机制
1)半数机制:集群中半数以上机器存活,集群可用.所以zookeeper适合装在奇数台机器上. 2)Zookeeper虽然在配置文件中并没有指定master和slave.但是,zookeeper工作时, ...
- HD-ACM算法专攻系列(4)——A == B ?
题目描述: 源码: /**/ #include"iostream" #include"string" using namespace std; string S ...
- Android setImageResource与setImageBitmap的区别
同样的布局文件,小分辨率手机: 1.使用setImageBitmap设置时,出现如下现象: 2.使用setImageResource时,图片显示正常 原因:setImageResource(id)会根 ...
- (转载) Android开发时,那些相见恨晚的工具或网站!
huangmindong的专栏 目录视图 摘要视图 订阅 赠书 | 异步2周年,技术图书免费选 程序员8月书讯 项目管理+代码托管+文档协作,开发更流畅 Android ...