MYSQL课程设计:图书管理系统!(基础知识之表的的建立与删除!)

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;

在这里插入图片描述
在这里插入图片描述

相关文章
相关标签/搜索