oracle 五天之前,Oracle课程档案,第五天
集合操作
desc job_history:改變歷史職位
job_history:歷史表
vnion:重復(fù)值只保留一個(gè) 去除重復(fù)值 ★★
vnion all: 把所有重復(fù)值保留 不去除重復(fù)值★★
intersect:相交
minus:減去
雙引號(hào)對(duì)不規(guī)范的對(duì)象命名★★
單引號(hào)是一個(gè)字符串★★
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跟上空值 個(gè)人理解
創(chuàng)建表:
create table:創(chuàng)建表
insert into:插入
update:更新
delete:刪除表里的數(shù)據(jù)
drop:刪除表
constraint:約束條件 commit:提交 創(chuàng)建表完事后 一定要提交 commit;
not null:非空
view:視圖 drop sequence course_cid; 刪除增量的名字 如果重復(fù)就用這個(gè)刪除 coure_cid為你創(chuàng)建的要?jiǎng)h除的重復(fù)名字
sequence:序列
uniquenes:唯一性 start with:從....開(kāi)始
varchar2:長(zhǎng)字符
modify:修改,添加
主鍵(primary key)約束、外鍵(foreign key)約束、唯一(unique)約束、檢查(check)約束、默認(rèn)值(default)約束實(shí)例
約束的類型有如下幾種:
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:第一列+數(shù)據(jù)類型
y:第二列+字符類型——字符類型必須加單引號(hào)
z:第三列+日期類型
select * from + 表名+想查的東西
desc+表名 也可以查
刪除表:drop table + 表名
user_table:當(dāng)前用戶下所有表的名字
刪除行(刪除數(shù)據(jù)):delete from table + 哪一行
DDL
修改表結(jié)構(gòu)
alter table t1 xxxxxx ★★
刪除列:alter t1 drop x
create table t1(x(列名)int(類型) constraint(約束條件) t1_x_pk(約束的名字)primarykey(主鍵));
Oracle課程檔案,第五天
標(biāo)簽:var???delete???命名???commit???creat???ref???字符類型???序列???單引號(hào)
本條技術(shù)文章來(lái)源于互聯(lián)網(wǎng),如果無(wú)意侵犯您的權(quán)益請(qǐng)點(diǎn)擊此處反饋版權(quán)投訴
本文系統(tǒng)來(lái)源:http://www.cnblogs.com/awdsjk/p/7289341.html
總結(jié)
以上是生活随笔為你收集整理的oracle 五天之前,Oracle课程档案,第五天的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: java追加字符串到文件_java 将字
- 下一篇: 计算机丢失i4m.dll,ntd.dll