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

navicat常用快捷键与SQL基本使用

时间:2019-06-24 16:57:48      阅读:540      评论:0      收藏:0      [点我收藏+]

标签:执行   order   size   from   font   max   粘贴   第一步   过滤   

一、Navicat常用快捷键

1,Ctrl+q就会弹出一个sql输入窗口 
2,Ctrl+r就执行sql了 
3,按f6会弹出一个命令窗口 
4,Ctrl+/ 注释 
5,Ctrl +Shift+/ 解除注释 
6,Ctrl+R 运行选中的SQL语句 
7,Ctrl+Shift+R 只运行选中的sql语句 
8,Ctrl+L 删除选中行内容 
9,Ctrl+D 表的数据显示显示页面切换到表的结构设计页面,但是在查询页面写sql时是复制当前行并粘贴到下一行 
10,Ctrl+N 打开一个新的查询窗口 
11,Ctrl+W 关闭当前查询窗口 
12,鼠标三击选择当前行

二、增删库表、字段、索引等操作

select s_name from t_stu; 
insert into t_stu(sname,sage)value(‘王欢’,23)—增加 
delete from t_stu where sage = 22;–删除 
update t_stu set sage=25 where sname =’唐强’;-修改

三、常用的关键字:

like%/like_、BETWEEN ANDinis nulldescDISTINCTgroup by、limit

四、聚合函数:

SUM()、AVG()、COUNTMAX()、MINI()

五、SQL执行顺序 F-W-G-S-H-O

第一步: 执行FROM 
第二步: WHERE条件过滤T 
第三步: GROUP BY 分组 
第四步: 执行SELECT投影列 
第五步:HAVING条件过滤 
第六步: 执行ORDER BY 排序

注意!! :在分组查询中,能够查询的字段只能是分组字段和聚合函数 
WHERE运行在分组前,故后面不能有聚合函数,HAVING运行在分组后,只能作聚合函数的过滤

六、CASE WHEN THEN

CASE 
WHEN total_amount<10 then 0 
when total_amount>=10 and total_amount<50 then 1 
when total_amount>=50 and total_amount<100 then 2 
when total_amount>=100 and total_amount<200 then 3 
when total_amount>=200 and total_amount<500 then 4 
when total_amount>=500 and total_amount<1000 then 5 
else 6 
end

 

 

 

navicat常用快捷键与SQL基本使用

标签:执行   order   size   from   font   max   粘贴   第一步   过滤   

原文地址:https://www.cnblogs.com/nietzsche2019/p/11077618.html

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