DDL是數(shù)據(jù)定義語言已骇,是SQL語言的組成部分。
常見的數(shù)據(jù)類型有:
(1)數(shù)值類型:int卵渴、number
(2)字符類型:char鲤竹、varchar、varchar2
(3)日起類型:date辛藻、DD-MON-YY
(4)BLOB(二進(jìn)制數(shù)):最大為4GB
CLOB(字符串?dāng)?shù)):最大為4GB
1)創(chuàng)建表
create table tb_user (
name varchar(50),
age int,
sex char(4)
);
2)查詢表
select * from tb_user;
3)刪除表
刪除方法①drop(該方法會將整張表刪除)
drop table tb_user;
刪除方法②truncate(該方法只會將表內(nèi)的數(shù)據(jù)刪除)
truncate table tb_user;
4)給表增加列
alter table tb_user add(address varchar(20),phone varchar(20));
5)修改表中的指定列
alter table tb_user modify(address varchar(50));
6)刪除表中指定列
alter table tb_user drop(phone);
7)修改表名稱
rename tb_user to tb_usreinfo;