MySQL表的維護(hù)和改造
改變列的數(shù)據(jù)類型
[sql]
ALTER TABLE visitor MODIFY nam VARCHAR(30);
追加新列
[sql]
ALTER TABLE visitor ADD age INT;
ALTER TABLE visitor ADD age INT FIRST;
ALTER TABLE visitor ADD age INT AFTER nam;
改變列的位置
[sql]
ALTER TABLE visitor MODIFY age INT AFTER nam;
改變列名 和 類型
[sql]
ALTER TABLE visitor CHANGE birth birthday DATE;
刪除列
[sql]
ALTER TABLE visitor DROP age;
表的復(fù)制
[sql]
CREATE TABLE customerH SELECT * FROM customer;
CREATE TABLE customerG LIKE customer;
INSERT INTO customerG SELECT * FROM customer;
INSERT INTO tb1G(no) SELECT bang FROM tb1;
表的刪除
[sql]
DROP TABLE IF EXISTS customerG;
DROP TABLE customerG;
bitsCN.com聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com