数据库中表格管理

1、创建表

create table xxx (id int primary key not null auto_increment,name varchar(20));

红色为字段属性

2、查看表格属性

dessc 表名;

3、查看表格内容

select * from 表名;

4、查看创建的表格语法格式

show create table 表名;

5、删除表

drop table  表名

6、为表格增加字段(加一个属性)

alter table 表名 add birhday datetime;

其中birthday为表格的属性,datetime为birthday的类型

7、将birthday更改为birth

alter table 表名 change birthday birth datetime;

8、将datetime 更改为date

alter table 表名 modify birth date;

9、删除表格的某一属性

alter table 表名 drop birth;

10、查看表属性以及创建表格

11、在空表格添加信息

12、更改表格信息

update students set gender=2 where id=3;

13、删除表格信息

delete from students where id=2;

                       

猜你喜欢

转载自blog.csdn.net/weixin_44046696/article/details/84952872