常用的MySQL命令
1、新建数据库: create database person;

2、使用数据库 use person;
3、创建一个表格 create table student (
id int(10) not null primary key,
name varchar(20),
age varchar(10),
sex varchar(10)
);

4、显示数据库中所有的表格: show tables;

5、在表格中插入一行数据: insert into student values(1,‘jxn’,'22','f');

6、查询表格中所有的记录:select * from student;

7、删除记录:delete from student where id=1;

8、删除所有记录: delete from student;

9、更新记录:update student set age='33 where id=2;

10、删除表格的列: alter table student drop sex;

11、增加表格列:alter table student add sex varchar(10);

12、改变数据类型:alter table student modify age int(10);

13、显示表格的字段:show columns from student;

14、删除表格:drop table student;

15、删除数据库: drop database person;


浙公网安备 33010602011771号