Home  >  Article  >  Database  >  不得不知道的mysql的基本操作

不得不知道的mysql的基本操作

WBOY
WBOYOriginal
2016-06-07 15:27:361381browse

MYSQL的基本语句 1.Createdatabase 数据库名; 创建数据库类型 2.show database; 显示所有数据库信息 3.use 数据库名; 选择数据库 4.drop database 数据库名; 删除数据库 5.create table 表名 (字段名1 类型, 字段名2 类型) 创建表 6.show cloums from

MYSQL的基本语句

1.Create database 数据库名;

创建数据库类型

 

2.show database;

显示所有数据库信息

 

3.use 数据库名;

选择数据库

 

4.drop database 数据库名;

删除数据库

 

5.create table 表名 (字段名1 类型, 字段名2 类型)

创建表格

 

6.show cloums from 数据库名.数据表名

显示指定的表结构

 

7.desc 表名列名;

显示表中一个字段的结构

 

8.alter table 表名 操作的关键字 具体操作

修改表

 

9.rename table 旧表名 to 新表名

改表名字

 

10.Drop table 表名;

删除表的名字

 

11.insert into 表名(字段名1,字段名2) values (对应的值1,对应的值2);

插入表

 

12.Concat()联合多列

使用concat函数可以联合多个字段,构成一个总的字符串

 

Select concat(name ,“:”,age) from user;

 

13.limit限定查询行数

Select * from 表名 limit 2,3

意思是从第二条记录连续读3条

 

14.sum()求和

15.Update 表名 set  字段名=对应的值 where 条件

更新表

16. delete from 表名 where 条件

删除表中的记录

17.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn