立即学习:https://edu.csdn.net/course/play/27328/362519?utm_source=blogtoedu
ddl之数据表
mysql存储引擎
1.查看mysql支持的存储引擎
show engines;
mysql5.5之后的版本使用的是InnoDB;
2.Momory存储引擎
所有数据村塾在内存中,响应快,mysql重启中数据全部丢失;
3.mysql8.0之后的版本,默认的字符编码是utf-8
#MySQL的建表语法
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] table_name [(create_definition,…)] [table_options]
[select_statement]
说明:
TEMPORARY:表示创建临时表,在当前会话结束后将自动消失
IF NOT EXISTS:在建表前,先判断表是否存在,只有该表不存在时才创建
create_definition:建表语句的关键部分,用于定义表中各列的属性
table_options:表的配置选项,例如:表的默认存储引擎、字符集
select_statement:通过select语句建表
create table contact
(id int not null auto_increment primary key,
sex char,
name varchar(20),
phone varchar(20)
);
alter table contact modify sex int;
alter table contact add age int;
alter table contact drop column sex;
drop table contact;