Oracle课程档案,第五天
Posted 麻包缝裤衩
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle课程档案,第五天相关的知识,希望对你有一定的参考价值。
集合操作
desc job_history:改变历史职位
job_history:历史表
vnion:重复值只保留一个 去除重复值 ★★
vnion all: 把所有重复值保留 不去除重复值★★
intersect:相交
minus:减去
双引号对不规范的对象命名★★
单引号是一个字符串★★
desc departments 查询部门表里面的有哪些列
desc employees 查询员工表里面的有哪些列
select employee_id, job_id from employees
union all
select employee_id, job_id from job_history;
select employee_id, job_id from employees
union
select employee_id, job_id from job_history;
select employee_id, job_id from employees
intersect
select employee_id, job_id from job_history;
select employee_id from employees
minus
select employee_id from job_history;
select employee_id, job_id, salary from employees
union all
select employee_id, job_id, null from job_history;
select employee_id, job_id, to_char(salary) from employees
union all
select employee_id, job_id, ‘no salary‘ from job_history;
集合排序:
select employee_id, job_id, salary from employees
union all
select employee_id, job_id, null from job_history
order by salary;
select employee_id, job_id, null from job_history
union all
select employee_id, job_id, salary from employees
order by 3;
salary null跟上空值 个人理解
创建表:
create table:创建表
insert into:插入
update:更新
delete:删除表里的数据
drop:删除表
constraint:约束条件 commit:提交 创建表完事后 一定要提交 commit;
not null:非空
view:视图 drop sequence course_cid; 删除增量的名字 如果重复就用这个删除 coure_cid为你创建的要删除的重复名字
sequence:序列
uniquenes:唯一性 start with:从....开始
varchar2:长字符
modify:修改,添加
主键(primary key)约束、外键(foreign key)约束、唯一(unique)约束、检查(check)约束、默认值(default)约束实例
约束的类型有如下几种:
C (check constraint on a table)
P (primary key)
U (unique key)
R (Referential AKA Foreign Key)
V (with check option, on a view)
O (with read only, on a view)
DML
x:第一列+数据类型
y:第二列+字符类型——字符类型必须加单引号
z:第三列+日期类型
select * from + 表名+想查的东西
desc+表名 也可以查
删除表:drop table + 表名
user_table:当前用户下所有表的名字
删除行(删除数据):delete from table + 哪一行
DDL
修改表结构
alter table t1 xxxxxx ★★
删除列:alter t1 drop x
create table t1(x(列名)int(类型) constraint(约束条件) t1_x_pk(约束的名字)primarykey(主键));
以上是关于Oracle课程档案,第五天的主要内容,如果未能解决你的问题,请参考以下文章