详解Oracle数据库中自带的所有表结构(sql代码)


Posted in Oracle onNovember 20, 2021

一、tb_emp(员工表)

1、建表

CREATE TABLE "TEST"."TB_EMP" (	
	"EMPNO" NUMBER(4,0) PRIMARY KEY NOT NULL, 
	"ENAME" VARCHAR2(10), 
	"JOB" VARCHAR2(9), 
	"MGR" NUMBER(4,0), 
	"HIREDATE" DATE, 
	"SAL" NUMBER(7,2), 
	"COMM" NUMBER(7,2), 
	"DEPTNO" NUMBER(2,0)
);
COMMENT ON COLUMN "TEST"."TB_EMP"."EMPNO" IS '员工编号';
COMMENT ON COLUMN "TEST"."TB_EMP"."ENAME" IS '姓名';
COMMENT ON COLUMN "TEST"."TB_EMP"."JOB" IS '职位';
COMMENT ON COLUMN "TEST"."TB_EMP"."MGR" IS '领导编号';
COMMENT ON COLUMN "TEST"."TB_EMP"."HIREDATE" IS '入职时间';
COMMENT ON COLUMN "TEST"."TB_EMP"."SAL" IS '基本工资';
COMMENT ON COLUMN "TEST"."TB_EMP"."COMM" IS '奖金';
COMMENT ON COLUMN "TEST"."TB_EMP"."DEPTNO" IS '部门编号';
COMMENT ON TABLE "TEST"."TB_EMP"  IS '员工表';

2、导入数据

INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7369,'史密斯','店员',7902,TIMESTAMP '1980-12-17 00:00:00.000000',800,NULL,20);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7499,'艾伦','售货员',7698,TIMESTAMP '1981-02-20 00:00:00.000000',1600,300,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7521,'沃德','售货员',7698,TIMESTAMP '1981-02-22 00:00:00.000000',1250,500,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7566,'琼斯','经理',7839,TIMESTAMP '1981-04-02 00:00:00.000000',2975,NULL,20);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7654,'马丁','售货员',7698,TIMESTAMP '1981-09-28 00:00:00.000000',1250,1400,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7698,'布莱克','经理',7839,TIMESTAMP '1981-05-01 00:00:00.000000',2850,NULL,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7782,'克拉克','经理',7839,TIMESTAMP '1981-06-09 00:00:00.000000',2450,NULL,10);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7788,'斯科特','分析师',7566,TIMESTAMP '1987-04-19 00:00:00.000000',3000,NULL,20);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7839,'国王','总统',NULL,TIMESTAMP '1981-11-17 00:00:00.000000',5000,NULL,10);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7844,'特纳','售货员',7698,TIMESTAMP '1981-09-08 00:00:00.000000',1500,0,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7876,'亚当斯','店员',7788,TIMESTAMP '1987-05-23 00:00:00.000000',1100,NULL,20);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7900,'詹姆斯','店员',7698,TIMESTAMP '1981-12-03 00:00:00.000000',950,NULL,30);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7902,'福特','分析师',7566,TIMESTAMP '1981-12-03 00:00:00.000000',3000,NULL,20);
INSERT INTO "TB_EMP" (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) VALUES (7934,'米勒','店员',7782,TIMESTAMP '1982-01-23 00:00:00.000000',1300,NULL,10);

3、查表

SELECT * FROM "TEST"."TB_EMP"

详解Oracle数据库中自带的所有表结构(sql代码) 

二、tb_dept(部门表)

1、建表

CREATE TABLE "TEST"."TB_DEPT" (	
	"DEPTNO" NUMBER(2,0) PRIMARY KEY NOT NULL,  
	"DNAME" VARCHAR2(14), 
	"LOC" VARCHAR2(13)
 );
COMMENT ON COLUMN "TEST"."TB_DEPT"."DEPTNO" IS '部门编号';
COMMENT ON COLUMN "TEST"."TB_DEPT"."DNAME" IS '部门名称';
COMMENT ON COLUMN "TEST"."TB_DEPT"."LOC" IS '部门所在位置';
COMMENT ON TABLE "TEST"."TB_DEPT"  IS '部门表';

2、导入数据

INSERT INTO "TB_DEPT" (DEPTNO,DNAME,LOC) VALUES (10,'会计','纽约');
INSERT INTO "TB_DEPT" (DEPTNO,DNAME,LOC) VALUES (20,'研究','达拉斯');
INSERT INTO "TB_DEPT" (DEPTNO,DNAME,LOC) VALUES (30,'销售','芝加哥');
INSERT INTO "TB_DEPT" (DEPTNO,DNAME,LOC) VALUES (40,'运营','波士顿');

3、查表

SELECT * FROM  "TEST"."TB_DEPT";

详解Oracle数据库中自带的所有表结构(sql代码)

三、tb_bonus(奖金表)

1、建表

CREATE TABLE TEST."TB_BONUS" (	
"ENAME" VARCHAR2(10), 
"JOB" VARCHAR2(9), 
"SAL" NUMBER, 
"COMM" NUMBER
); 
COMMENT ON COLUMN "TEST"."TB_BONUS"."ENAME" IS '姓名';
COMMENT ON COLUMN "TEST"."TB_BONUS"."JOB" IS '职位';
COMMENT ON COLUMN "TEST"."TB_BONUS"."SAL" IS '基本工资'; 
COMMENT ON COLUMN "TEST"."TB_BONUS"."COMM" IS '奖金';
COMMENT ON TABLE "TEST"."TB_BONUS"  IS '奖金表';

2、导入数据

3、查表

详解Oracle数据库中自带的所有表结构(sql代码)

四、tb_salgrade(工资等级表)

1、建表

CREATE TABLE "TEST"."TB_SALGRADE" (
	"GRADE" NUMBER, 
	"LOSAL" NUMBER, 
	"HISAL" NUMBER
);
COMMENT ON COLUMN "TEST"."TB_SALGRADE"."GRADE" IS '工资等级';
COMMENT ON COLUMN "TEST"."TB_SALGRADE"."LOSAL" IS '最低工资';
COMMENT ON COLUMN "TEST"."TB_SALGRADE"."HISAL" IS '最高工资';
COMMENT ON TABLE "TEST"."TB_SALGRADE"  IS '工资等级表';

2、导入数据

INSERT INTO TEST.TB_SALGRADE (GRADE,LOSAL,HISAL) VALUES (1,700,1200);
INSERT INTO TEST.TB_SALGRADE (GRADE,LOSAL,HISAL) VALUES (2,1201,1400);
INSERT INTO TEST.TB_SALGRADE (GRADE,LOSAL,HISAL) VALUES (3,1401,2000);
INSERT INTO TEST.TB_SALGRADE (GRADE,LOSAL,HISAL) VALUES (4,2001,3000);
INSERT INTO TEST.TB_SALGRADE (GRADE,LOSAL,HISAL) VALUES (5,3001,9999);

3、查表

SELECT * FROM TEST.TB_SALGRADE;

详解Oracle数据库中自带的所有表结构(sql代码)

 五、tb_users(用户表)

1、建表

CREATE TABLE "TEST"."TB_USERS" (	
	"ID" VARCHAR2(10) PRIMARY KEY NOT NULL,  
	"USERNAME" VARCHAR2(64), 
	"PASSWORD" VARCHAR2(64),
	"AGE" NUMBER(3,0),
	"SEX" VARCHAR2(1)
);
 
COMMENT ON COLUMN "TEST"."TB_USERS"."ID" IS '用户唯一id';
COMMENT ON COLUMN "TEST"."TB_USERS"."USERNAME" IS '用户名';
COMMENT ON COLUMN "TEST"."TB_USERS"."PASSWORD" IS '密码';
COMMENT ON COLUMN "TEST"."TB_USERS"."AGE"  IS '年龄';
COMMENT ON COLUMN "TEST"."TB_USERS"."SEX"  IS '性别';
COMMENT ON TABLE "TEST"."TB_USERS"  IS '用户表';

2、导入数据

INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('1','史密斯','123456',23,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('2','艾伦','123456',18,'0');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('3','沃德','123456',28,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('4','琼斯','123456',19,'0');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('5','马丁','123456',25,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('6','布莱克','123456',27,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('7','克拉克','123456',29,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('8','斯科特','123456',32,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('9','国王','123456',90,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('10','特纳','123456',52,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('11','亚当斯','123456',46,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('12','詹姆斯','123456',34,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('13','福特','123456',65,'1');
INSERT INTO "TB_USERS" (ID,USERNAME,PASSWORD,AGE,SEX) VALUES ('14','米勒','123456',75,'1');

3、查表

select * from "TEST"."TB_USERS";

详解Oracle数据库中自带的所有表结构(sql代码)

 六、tb_saldetail(工资详细表)

1、建表

CREATE TABLE "UCLM"."TB_SALDETAIL" (
    "SALNO" NUMBER(4,0) PRIMARY KEY NOT NULL, 
    "ENAME" VARCHAR2(10),
    "SALYEAR"  VARCHAR2(10),
    "SALMONTH" VARCHAR2(4),
    "SAL" NUMBER(7,2), 
    "COMM" NUMBER(7,2), 
    "EMPNO" NUMBER(4,0) 
);
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."SALNO" IS '工资编号';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."ENAME" IS '姓名';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."SALYEAR" IS '发薪年份';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."SALMONTH" IS '发薪月份';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."SAL" IS '基本工资';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."COMM" IS '奖金';
COMMENT ON COLUMN "UCLM"."TB_SALDETAIL"."EMPNO" IS '员工编号';
COMMENT ON TABLE "UCLM"."TB_SALDETAIL"  IS '工资详细表';

2、导入数据

INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(1, '史密斯', '2020', '01', 800, 0, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(2, '史密斯', '2020', '02', 801.14, 300, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(3, '史密斯', '2020', '03', 804.21, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(4, '史密斯', '2020', '04', 806.41, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(5, '史密斯', '2020', '05', 800.55, 100, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(6, '史密斯', '2020', '06', 806.14, 200, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(7, '史密斯', '2020', '07', 800.55, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(8, '史密斯', '2020', '08', 806.84, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(9, '史密斯', '2020', '09', 800.77, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(10, '史密斯', '2020', '10', 806.85, null, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(11, '史密斯', '2020', '11', 800.83, 0, 7369);
INSERT INTO TEST.TB_SALDETAIL (SALNO, ENAME, SALYEAR, SALMONTH, SAL, COMM, EMPNO) VALUES(12, '史密斯', '2020', '12', 806.14, 100, 7369);

3、查表

详解Oracle数据库中自带的所有表结构(sql代码)

到此这篇关于Oracle数据库中自带的所有表结构的文章就介绍到这了,更多相关Oracle数据库所有表结构内容请搜索三水点靠木以前的文章或继续浏览下面的相关文章希望大家以后多多支持三水点靠木!

Oracle 相关文章推荐
oracle表分区的概念及操作
Apr 24 Oracle
Oracle 区块链表创建过程详解
May 15 Oracle
Oracle11g r2 卸载干净重装的详细教程(亲测有效已重装过)
Jun 04 Oracle
Oracle创建只读账号的详细步骤
Jun 07 Oracle
SQL模糊查询报:ORA-00909:参数个数无效问题的解决
Jun 21 Oracle
快速学习Oracle触发器和游标
Jun 30 Oracle
oracle连接ODBC sqlserver数据源的详细步骤
Jul 25 Oracle
Oracle中update和select 关联操作
Jan 18 Oracle
Lakehouse数据湖并发控制陷阱分析
Mar 31 Oracle
Oracle 多表查询基本语法实例
Apr 18 Oracle
Oracle用户管理及赋权
Apr 24 Oracle
Oracle表空间与权限的深入讲解
Nov 17 #Oracle
详解Oracle块修改跟踪功能
Nov 07 #Oracle
Oracle安装TNS_ADMIN环境变量设置参考
Nov 01 #Oracle
关于Oracle12C默认用户名system密码不正确的解决方案
Oct 16 #Oracle
C#连接ORACLE出现乱码问题的解决方法
Oct 05 #Oracle
Oracle 临时表空间SQL语句的实现
Sep 25 #Oracle
oracle索引总结
Sep 25 #Oracle
You might like
PHP4实际应用经验篇(4)
2006/10/09 PHP
php设计模式 Command(命令模式)
2011/06/26 PHP
Laravel Intervention/image图片处理扩展包的安装、使用与可能遇到的坑详解
2017/11/14 PHP
IE 上下滚动展示模仿Marquee机制
2009/12/20 Javascript
html文本框提示效果的示例代码
2014/06/28 Javascript
JavaScript数组常用操作技巧汇总
2014/11/17 Javascript
javascript感应鼠标图片透明度显示的方法
2015/02/24 Javascript
JQuery判断checkbox是否选中及其它复选框操作方法合集
2015/06/01 Javascript
JS+CSS实现鼠标滑过时动态翻滚的导航条效果
2015/09/24 Javascript
解决JS请求服务器gbk文件乱码的问题
2015/10/16 Javascript
angularjs表格ng-table使用备忘录
2016/03/09 Javascript
AngularJS入门教程之 XMLHttpRequest实例讲解
2016/07/27 Javascript
jQuery弹出div层过2秒自动消失
2016/11/29 Javascript
利用jquery如何从json中读取数据追加到html中
2017/12/01 jQuery
js判断传入时间和当前时间大小实例(超简单)
2018/01/11 Javascript
浅析JS中什么是自定义react数据验证组件
2018/10/19 Javascript
vue监听用户输入和点击功能
2019/09/27 Javascript
[01:03]悬念揭晓 11月26日DOTA2完美盛典不见不散
2017/11/23 DOTA
安装dbus-python的简要教程
2015/05/05 Python
python3操作mysql数据库的方法
2017/06/23 Python
TensorFlow高效读取数据的方法示例
2018/02/06 Python
python sqlite的Row对象操作示例
2019/09/11 Python
解决Tensorflow 内存泄露问题
2020/02/05 Python
Python 通过爬虫实现GitHub网页的模拟登录的示例代码
2020/08/17 Python
Python在线和离线安装第三方库的方法
2020/10/31 Python
python使用numpy中的size()函数实例用法详解
2021/01/29 Python
韩国邮政旗下生鲜食品网上超市:epost
2016/08/27 全球购物
Beauty Expert美国/加拿大:购买奢侈美容产品
2018/12/05 全球购物
BSTN意大利:德国街头和运动文化高品质商店
2020/12/22 全球购物
this关键字的含义
2015/04/08 面试题
机电一体化毕业生求职信
2013/11/02 职场文书
简短大学毕业感言
2014/01/18 职场文书
个人委托书如何写
2014/09/25 职场文书
四风问题查摆剖析材料
2014/10/11 职场文书
2016大学生求职自荐信范文
2016/01/28 职场文书
PyTorch 如何检查模型梯度是否可导
2021/06/05 Python