找回密码
 立即注册

推荐阅读

  • 便民服务
  • 关注我们
  • 社区新手
select * from 表名:
* 通配符 所有的

select id from 表名  查询特定要求的字段

where 条件语句
select id from wuhan3 where id =5;
or and
= <=  >= < > != mysql 当中的比较符号
in not in
一个属于 select * from wuhan3 where id in(2,4);
已不属于 select * from wuhan3 where id not in(2,4);

is null  is not null  #查询为空与不为空的数据
select * from wuhan3 where name is not  null;
select * from wuhan3 where name is null;

update 我们在修改表数据的时候,一定要注意要加修改的条件
不然就会全部进行修改

mysql聚合函数的用法 count,sum,min, max,avg,distinct;
select 函数符号(表字段) form 表名称:


like的用法:

取别名 select 函数(表字段)as  新字符  from  表名:

排序查看用 order by
升序:asc
select * from +表名 order by 字段 asc
order by ...asc 从小到大排序
降序:desc
select * from +表名 order by 字段 desc
order by ... desc 从大到小排序
group by一般是接聚合函数使用,不能和分组以外的字段结合使用
那么接其他字段他不会报错,但是会造成数据混乱。
select * from +表名 group by 字段

group by 后面不能接where使用,如果要接查询条件的话用having进行
接条件,having的作用相当于where
select * from +表名 group by 字段 having 条件


备份,只是备份表结构,并不会备份表数据
create table wuhan4 like wuhan3;



备份一个数据库,进行还原时,sql文件进行还原到某一个数据库当中
所以说还原时,新建一个数据库进行还原。


权限;
usage 没有权限
ALL  代表所有的权限
查询mysql数据库服务器已经创建了哪些用户:
select host,user from user;
创建用户但是未授权(方法一)
insert into user (host,user,password)values('localhost','wang',password('123456'));
flush privileges ---刷新


进入root 数据库查看,给与权限;
创建用户后进行授权(方法二)
grant select,update,delete,drop on *.* to 'wang'@'localhost' identified by
'123456
分享至 : QQ空间
收藏

0 个回复

您需要登录后才可以回帖 登录 | 立即注册