码迷,mamicode.com
首页 > 数据库 > 详细

常用的MySQL命令

时间:2017-10-17 12:14:31      阅读:253      评论:0      收藏:0      [点我收藏+]

标签:png   9.png   sele   查询   使用   sql   not   bsp   creat   

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;

技术分享

 

常用的MySQL命令

标签:png   9.png   sele   查询   使用   sql   not   bsp   creat   

原文地址:http://www.cnblogs.com/tangqiu/p/7680164.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!