内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

Oracle知識梳理


create tablespace user1 datefile '' size 20M //創(chuàng)建一個名為User1的表空間

肅寧ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!

autoextend on//數(shù)據(jù)文件的可擴展性

autoextend off//關閉

autoextend on next 5M//指定數(shù)據(jù)文件的增長幅度

autoextend on next 5m maxsize 500M

//查看表空間是否創(chuàng)建成功

select file_name,tablespace_name from dba_data_files order by file_name

//查看表空間

select tablespace_name,status,allocation_type from dba_tablespaces

select user_id,username,default_tablespace from dba_users//修改數(shù)據(jù)庫默認表空間的的SQL語句

alter tablespace default tablespace user1

alter tablespace user2 rename to user20

dorp tablespace user20 including contents and datafiles

//創(chuàng)建主鍵約束

create table student (student_id number primary key,student_name vachar2(20),student_birthday date,student_address vachar2(50),student_phone vachar2(20))

//建立外鍵

create table customers(customer_id number primary key,customers_name vachar2(50),customers_address vachar2(50),customers_phone vachar2(20),email vachar2(20))

create table orders(orders_id number primary key,customers_id number,goods_name vachar2(20),quantity number,unit vachar2(10))

alter table orders add constraint fk_orders_customer foreign key (customer_id) referemces customers (customer_id)

//創(chuàng)建視圖

create table employees1(employee_id number primary key,first_name vachar2(4),last_name vachar2(4),province vachar2(10),city vachar2(10),salary number)

select text from user_views where view_name='VW_EMPLOYEES'

select *from VW_EMPLOYEES

//修改視圖

create or replace view VW_EMPLOYEES as 

select employee_id,last_name||first_name as employee_name,province||'-'||city as location,salary from employees1

//刪除視圖

drop view VW_EMPLOYEES

//創(chuàng)建索引

create index idx orders(orders_id,goods_name)

函數(shù)

//截取字符串

select substr('1234567890',5,4) from dual;//第五位開始的四個字符

//獲得字符串出現(xiàn)的位置

select instr('big big tiger','big') from dual;

itrim()//刪除字符串首部空格

rtrim()//刪除字符串尾部空格

current_timestamp()//返回當前會話時區(qū)的當前時間戳

current_times()//返回當前會話時區(qū)的當前日期

//in判式用于判斷表的列值是否存在于列表(集合)中。而exists判式則可用于判斷查詢結果集合是否為空

//排名

select student_name,rank() over(orders by student_age) position from student;

//if else

set serverout on;

delete employee_num number;

begin

select count(*) into employee_num from t_employees where status="ACT";

if employees_num>0 then

dbms_output.put_line('存在記錄');

else

dbms_output.put_line('不存在記錄');

end if;

end;

//case when

declare employee_num number;

begin

select count(*) into employee_num from t_employees where status="ACT";//將數(shù)目存儲到變量employee_num中

case

when employee_num>1 then

dbms_output.put_line('存在多條有效記錄');

when employee_num=1 then

dbms_output.put_line('僅存在一條有效記錄');

else

dbms_output.put_line('不存在記錄');

end case;

end;

創(chuàng)建儲存過程

create or replace procedure update_students

begin

update student set student_age=10;

commit;

end update_students;

//執(zhí)行儲存過程

excute update_students;

IN OUT 參數(shù)

create or replace procedure swap(in_out_param1 in out number,in_out_param2 in out number) as

begin

declare param number;

begin

param:=in_out_param1;

in_out_param1:=in_out_param2;

in_out_param2:=param;

end;

end;

樹形查詢

查詢 

查找重復數(shù)據(jù)

select distinct month from t_salary//獲得唯一性記錄

order by //升序(asc)和降序(desc)排列

group by //用于對記錄集合進行分組

having //對數(shù)據(jù)源進行條件過濾

網(wǎng)站標題:Oracle知識梳理
當前網(wǎng)址:http://www.rwnh.cn/article42/jdiehc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設、網(wǎng)站維護、商城網(wǎng)站、面包屑導航、定制網(wǎng)站網(wǎng)站制作

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)

綿陽服務器托管
化德县| 黄石市| 调兵山市| 阿尔山市| 南投县| 定兴县| 惠水县| 洪江市| 勐海县| 浮山县| 澄江县| 巴彦淖尔市| 柳州市| 福清市| 剑河县| 司法| 衢州市| 晋江市| 昌吉市| 登封市| 泰州市| 吉林市| 台江县| 宾川县| 大邑县| 宜城市| 图们市| 六盘水市| 都江堰市| 睢宁县| 原平市| 扶风县| 通化市| 苗栗市| 临颍县| 宜宾县| 兴和县| 定安县| 清徐县| 台东县| 年辖:市辖区|