運算元據庫表的幾個DML Oracle

2021-04-24 07:56:32 字數 481 閱讀 2458

1、有兩個表a,b。如果要把a中的部分或全部資料放到b中(前提是對應資料型別一致),可以用如下插入語句:

insert into a(x, y, z) select l, m, n from b;(部分插入)

insert into a select * from b;(全部插入)

2、建立新錶a的同時把b表中的資料拷貝過去,可用如下語句:

create table a as (select * from b);

3、修改表的字段型別,如下:

alter table a modify x char(3);

4、增加表的字段,如下:

alter table a add x char(3);

5、刪除表的字段,如下:

alter table a drop column x;

6、修改表的欄位名稱,如下:

alter table a rename column x to y;

運算元據庫 表

1 連線到mysql伺服器 mysql u使用者名稱 p2 檢視全部資料庫 show databases 3 選擇要操作的資料庫 use 資料庫名稱 4 檢視某個資料庫的所有表 show tables 運算元據庫 建立資料庫 create database 資料庫名稱 刪除資料庫 drop data...

MySQL運算元據庫表

1,建立表的時候寫注釋 create table if not exists demo dictionary id varchar 32 not null comment 主鍵id primary key,dictionary name varchar 100 not null comment 名稱...

DDL 運算元據庫 表

1 c create 建立 建立資料庫 create database 資料庫名稱 建立資料庫,判斷不存在,再建立 create database if not exists 資料庫名稱 建立資料庫,並指定字符集 create database 資料庫名稱 character set 字符集名 2 ...