DDL語句總結

2021-09-03 02:12:00 字數 590 閱讀 8588

ddl(資料庫定義語言)由create, alter,truncate,drop 組成。

1. create 建立表

create table 表名

屬性名  屬性型別 [約束條件],

2. alter 修改表結構

1. 新增新的列

alter table 表名 add  列名 型別 [default]

2. 改變列的順序

alter table 表名 modify 列名 datatype 新列名

alter table 表明 modify 列名 first/last [某一列]

3. 修改列名必須要change 

alter table 表名 change 舊表名 新表明 datatype [first | after] [default expression]

4. 刪除列

alter table 表明 drop 列名

5. 重新命名表

alter table 表名 rename 新錶名

3.drop 刪除表 

drop table 表名

4. truncate 刪除表中的全部資料,但是保留表結構。

oracle總結之八 DDL語句

建立與管理表 資料庫中物件 有表 檢視 索引 序列 同義詞等。表 基本的資料儲存的集合,由行與列組成 檢視 從表中抽出的邏輯上相關的資料集合。序列 提供有規律的數值 索引 提高查詢效率 同義詞 給物件起的別名。o racle資料庫中的表 1 使用者自定義表 表名和列名的命名規範 l 必須以字母開頭 ...

常用DDL語句

1 修改欄位名稱 alter table t user login log change device id session id varchar 256 2 修改注釋 alter table t user login log modify column session id varchar 256...

DDL語句規範

create database dborder character set utf8 use dborder create table page id bigint 20 unsigned not null auto increment comment 自增id url varchar 255 no...