1、新建数据库: create database person;

常用的MySQL命令

2、使用数据库 use person;

3、创建一个表格 create table student (

         id int(10) not null primary key,

         name varchar(20),

         age varchar(10),

         sex varchar(10)

         );   

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

 常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

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

常用的MySQL命令

 14、删除表格:drop table student;

常用的MySQL命令

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

常用的MySQL命令

 

相关文章:

  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-07
  • 2022-12-23
  • 2022-01-01
  • 2021-12-06
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2021-09-12
  • 2021-09-17
相关资源
相似解决方案