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中,常见的数据类型有: 字符串:字符 ...
随机推荐
- 基于One-Class的矩阵分解方法
在矩阵分解中. 有类问题比較常见,即矩阵的元素仅仅有0和1. 相应实际应用中的场景是:用户对新闻的点击情况,对某些物品的购买情况等. 基于graphchi里面的矩阵分解结果不太理想.调研了下相关的文献 ...
- 【甘道夫】Hadoop2.2.0环境使用Sqoop-1.4.4将Oracle11g数据导入HBase0.96,并自己主动生成组合行键
目的: 使用Sqoop将Oracle中的数据导入到HBase中,并自己主动生成组合行键! 环境: Hadoop2.2.0 Hbase0.96 sqoop-1.4.4.bin__hadoop-2.0.4 ...
- uva_644暴力加字典树解法
暴力 #include<iostream> #include<string.h> #include<cstdio> using namespace std; int ...
- 十分钟掌握diff&patch用法
作为程序员,了解diff&patch命令是非常必要的.比如说我们发现某个项目有bug代码,而自己又没有svn的提交权限,那么此时最合适的解决方法就是用diff命令做一个补丁发给项目成员.项目成 ...
- legend---十、thinkphp中如何进行原生sql操作
legend---十.thinkphp中如何进行原生sql操作 一.总结 一句话总结:query方法和execute方法 Db类支持原生SQL查询操作,主要包括下面两个方法: query方法 quer ...
- Oracle 11g AWR生成报告
1.生成单实例 AWR 报告: @$ORACLE_HOME/rdbms/admin/awrrpt.sql 2.生成 Oracle RAC AWR 报告: @$ORACLE_HOME/rdbms/adm ...
- 使用ffmpeg批量合并flv文件
title: 使用ffmpeg批量合并flv文件 toc: false date: 2018-10-14 16:08:19 categories: methods tags: ffmpeg flv 使 ...
- Avalon.js 实现列表
<table border="0" cellpadding="0" cellspacing="0" class="tab1& ...
- 【参考】.class文件的JDK编译版本查看
使用 UltraEdit 打开 .class 文件,第一行内容: 00000000h: CA FE BA BE 00 00 00 32 00 A9 07 00 02 01 00 37 ; 漱壕... ...
- 「JavaSE 重新出发」02.02 引用数据类型
引用(复合)数据类型 1. 枚举类型 例: 枚举类型 Size 的声明: enum Size { SMALL, MEDIUM, LARGE, EXTRA_LARGE }; 声明 Size 类型变量: ...