DDL语言的学习
一、DDL語言的學(xué)習(xí)
? 1.create關(guān)鍵字,用來創(chuàng)建表結(jié)構(gòu)
/*格式如下:
create table tname(
colName dataType,
colName dataType,
………………
colName dataType
);
*/
2:alter,用來修改表結(jié)構(gòu)
? 1)增加表的字段
--格式: alter table tname add (colName dataType);
--練習(xí):為表temp_1增加個(gè)字段 tage 類型為number,長度為2
alter table temp_1 add (tage number(2));
? 2)刪除表的字段
-- 格式: alter table tname drop column colName
-- 練習(xí):刪除temp_1表中的tage
alter table temp_1 drop column tage;
?3)修改字段的名稱
-- 格式: alter table tname rename column oldName to newName
-- 練習(xí):將表temp_1的tname修改成name
alter table temp_1 rename column tname to name;
?4)修改字段的數(shù)據(jù)類型
-- 格式:alter table tname modify colName dataType
-- 練習(xí):修改temp_1表中的name 為varchar2(30);
alter table temp_1 modify name varchar2(30);
5)修改表名
-- 格式:rename oldTname to newTname
-- 練習(xí):修改temp_1為temp_2;
rename temp_1 to temp_2;
?6)刪除表結(jié)構(gòu)
-- 格式:drop table tname;
-- 練習(xí):將temp_2刪除
drop table temp_2;
7)查看表結(jié)構(gòu)
-- 格式: desc tname;
-- 練習(xí):創(chuàng)建temp_1,查看表結(jié)構(gòu)
desc temp_1;
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/xiaozelulu/p/8835761.html
總結(jié)
- 上一篇: wrz耳机是什么品牌
- 下一篇: 楚留香树下翁怎么触发(汉典楚字的基本解释