MYSQL:
查詢支持的所有引擎
數據庫
show engines;
查詢默認的存儲引擎:
spa
show variables like 'storage_engine%'; //或 show variables like 'storage%';
建立數據表:
3d
create [temporary] table [if not exists] #(); //temporary:建立一個臨時表;
查看錶:
code
show tables;//#:數據庫名
查看錶結構:
blog
show columns from hello_01 frim hello;
describe #;
describe hello_01 id; //或 desc hello_01 id;
修改表:
添加列:
圖片
alter table hello_01 add password varchar(20);
修改列:
table
alter table hello_02 modify name varchar(30);
刪除列:
class
alter table hello_01 drop password; //或 alter table hello_01 drop column name;
查詢表數據:
bfc
select * from hello_02;
重命名錶:
select
rename table #1 to #2;
複製表:
//不復制數據 create table hello_02copy like hello_02;
//且複製數據: create table hello_02copy01 as select * from hello_02;
刪除表:
drop table hello_02copy01; //或 drop table hello_02copy01; drop table if exists hello_02copy;