MySQL 入门 之 表 的 创建、修改与删除
- MySQL 的启动
(1)启动 XAMPP ,点击 start ,此时 MySQL 变绿 ;
(2)启动 MySQL Workbench,在 MySQL Connections 添加连接。
- MySQL 表 的 创建、修改与删除
直接上代码
create table my_fir_tab(
id int(3),
name varchar(20),
addr varchar(50)) ;
rename table my_fir_tab to my_sec_tab;
alter table my_sec_tab rename to my_fir_tab;
alter table my_fir_tab add email varchar(50);
alter table my_fir_tab change id newid int(5);
alter table my_fir_tab drop addr;
show tables from my_fir_db;
describe my_fir_tab;
show databases;
drop table my_fir_tab;
show databases;
备注:
创建表 create table;
表的重命名 rename table *** to;
表的重命名alter table *** rename to;
表的增删改 alter table *** add/change/drop;
删除表 drop table;
显示数据库 show databases;
显示表 describe ***;
还没有评论,来说两句吧...