標籤:刪除表 into username select 退出 ble insert har 刪除資料庫
一、查詢所有資料庫
代碼:show databases;
成功後如:
二、建立一個資料庫
代碼:create database test3;
成功後如:
三、串連資料庫
代碼:use test3;
成功後如:
四、建立庫表
代碼:create table test{
id int not null primary key auto_increment,
name varchar(30) not null
};
成功後顯示:
五、顯示表結構
代碼:desc test;
成功後顯示:
六、添加表內容
代碼:insert into test (`name`)values(‘test‘);
成功後顯示:
七、查詢表內容
代碼:select * from test;
成功後顯示:
八、修改表內容
代碼:update test set name = ‘test2‘;
成功後顯示:
九、刪除表內容
代碼:delete from test;
成功後顯示:
十、添加表欄位
代碼:alter table test add password varchar(30) not null;
成功後顯示:
十一、修改表欄位名
代碼:alter table test change name username varchar(50) not null;
成功後顯示:
十二、修改表欄位類型
代碼:alter table test modify username char(30) not null;
成功後顯示:
十三、刪除表欄位
代碼:alter table test drop username;
成功後顯示:
十四、刪除資料庫表
代碼:drop table test;
成功後顯示:
十五、刪除資料庫
代碼:drop databases test3;
成功後顯示:
十六:關閉資料庫
代碼:exit;
成功後退出命令列關閉。
MYSQL 簡單的建庫作業碼