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中,常见的数据类型有: 字符串:字符 ...
随机推荐
- yolo源码解析(1):代码逻辑
一. 整体代码逻辑 yolo中源码分为三个部分,\example,\include,以及\src文件夹下都有源代码存在. 结构如下所示 ├── examples │ ├── darknet.c(主程序 ...
- bzoj3295: [Cqoi2011]动态逆序对(cdq分治+树状数组)
3295: [Cqoi2011]动态逆序对 题目:传送门 题解: 刚学完cdq分治,想起来之前有一道是树套树的题目可以用cdq分治来做...尝试一波 还是太弱了...想到了要做两次cdq...然后伏地 ...
- web security
brute force cracking 暴力破解 Brute force (also known as brute force cracking) is a trial and error me ...
- 一个比NPM更快更安全可靠的JavaScript包管理工具——Yarn
yarn安装: npm intall -g yarn 查看安装是否成功: yarn -v yarn常用的命令以及和npm的对照如下: 更详细的请查看官方文档
- [Codeforces 911F] Tree Destruction 解题报告(贪心)
题目链接: http://codeforces.com/contest/911/problem/F 题目大意: 给你一棵树,每次挑选这棵树的两个度数为1的点,加上他们之间的边数(距离),然后将其中一个 ...
- Binary Indexed Tree
我借鉴了这个视频中的讲解的填坑法,我认为非常易于理解.有FQ能力和基本英语听力能力请直接去看视频,并不需要继续阅读. naive 算法 考虑一个这样的场景: 给定一个int数组, 我们想知道它的连续子 ...
- yaml文件结构
VERSION: 1.0.0.1 --指定控制文件schema的版本DATABASE: db_name --指定连接数据库的名字,如果没有指定,由环境变量$P ...
- Debian/Linux 下无线网卡驱动的安装
我的 PC 型号是 Acer V3-572G, 安装了 Debian 后, 发现只能通过有线网络上网, 无法识别无线网卡, 以下是解决的过程(不局限于此型号 PC): 在命令行键入 lspci , 得 ...
- Python 计算相似度
#计算相似度 #欧式距离 # npvec1, npvec2 = np.array(det_a), np.array(det_b) # similirity=math.sqrt(((npvec1 - n ...
- GDOI2017 再次酱油记
Day 0 13:00 pm 啊...今天中午一点钟从ez出发,感觉吼有趣啊.出发前先大喊一声****,在书包里放一本党史,感觉玄学可以救命[滑稽] 15:00 pm 到达东莞,坐标:石龙名冠金凯悦大 ...