w3resource_MySQL练习:Basic_select_statement
w3resource_MySQL练习题:Basic_select_statement
-- 要点:as设置别名,as可省略 select first_name as "First Name", last_name as "Last Name" from employees
-- 要点:select时添加distinct获取唯一值 select distinct department_id from employees
-- 要点:order by进行排序,desc进行降序排序 select * from employees order by first_name desc
-- 要点:select中可以进行数学运算 select first_name, last_name, salary, salary*0.15 as PF from employees
-- 要点:order by + asc select employee_id, first_name, last_name, salary from employees order by salary asc
-- 要点:sum()加总 select sum(salary) from employees
-- 要点:max() + min() select max(salary), min(salary) from employees
-- 要点:avg()均值 + count()计数 select avg(salary), count(*) from employees
-- 要点:count() select count(*) from employees
-- 要点:count() + distinct select count(distinct job_id) from employees
-- 要点:upper() select upper(first_name) from employees
-- 要点:left()从左开始取字符 select left(first_name, 3) from employees
-- 要点:select可直接计算 select 171*214+625
-- 要点:concat()两列字符串组合 select concat(first_name, ' ', last_name) from employees
-- 要点:trim()去除两边空格 select trim(first_name) from employees
-- 要点:length()计算长度 select length(first_name)+first_name(last_name) from employees
-- 要点:where里使用 REGEXP 实现正则效果 select * from employees where first_name REGEXP '[0-9]'
-- 要点:limit限制取数量 select * from employees limit 10
-- 要点:round()实现小数位控制 select first_name, last_name, round(salary/12, 2) as 'Monthly Salary' from employees
w3resource_MySQL练习:Basic_select_statement的更多相关文章
- w3resource_MySQL练习:Joins
w3resource_MySQL练习题:Joins 1. Write a query to find the addresses (location_id, street_address, city, ...
- w3resource_MySQL练习:Subquery
w3resource_MySQL练习题:Subquery 1. Write a query to find the name (first_name, last_name) and the salar ...
- w3resource_MySQL练习: Aggregate_functions
w3resource_MySQL练习题:Aggregate_functions 1. Write a query to list the number of jobs available in t ...
随机推荐
- Net Core IIS Express In
IIS Express In Asp.Net Core IIS Express是一个Mini版的IIS,能够支持所有的Web开发任务,但是这种设计有一些缺陷,例如只能通过localhost:< ...
- Java8中的新特性Optional
Optional 类是一个可以为null的容器对象.如果值存在则isPresent()方法会返回true,调用get()方法会返回该对象.Optional 是个容器:它可以保存类型T的值,或者仅仅保存 ...
- (转)io优化
原文:http://blog.csdn.net/gzh0222/article/details/9227393 1.系统学习 IO性能对于一个系统的影响是至关重要的.一个系统经过多项优化以后,瓶颈往往 ...
- Java VisualVM添加Visual GC插件
1.访问地址:https://visualvm.github.io/pluginscenters.html,找到自己JDK版本对应的插件下载地址(我的JDK版本为1.7.0_67): 2.点击该链接进 ...
- Swagger 2.0 集成配置
传统的API文档编写存在以下几个痛点: 对API文档进行更新的时候,需要通知前端开发人员,导致文档更新交流不及时: API接口返回信息不明确 大公司中肯定会有专门文档服务器对接口文档进行更新. 缺乏在 ...
- c# Redis操作类
需要添加StackExchange.Redis.dll引用 using System; using System.Collections.Generic; using System.IO; using ...
- Eclipse的安装与使用
1安装 下载 http://www.eclipse.org 安装 (最好下载解压版的,不用安装) 安装目录中,不要出现空格与中文 例如,解压到:D:\codetool 2项目的创建 双击运行.exe文 ...
- sublime text 3 入门技巧与常见问题解决
1. 常见问题 - 解决sublime 窗口栏(UNREGISTERED)(未购买)导致的经常性弹窗 解决方法: 点击Help -> About Sublime Text,查看sublimete ...
- 小白学phoneGap《构建跨平台APP:phoneGap移动应用实战》连载三(通过实例来体验生命周期)
4.1.2 通过实例来亲身体验Activity的生命周期 上一小节介绍了Activity生命周期中的各个过程,本小节将以一个简单的实例来使读者亲身体验到Activity生命周期中的各个事件. 在Ec ...
- Protocol Buffer学习教程之开篇概述(一)
1. Protocol Buffer是什么 Protocol Buffer是google旗下的产品,用于序列化与反序列化数据结构,但是比xml更小.更快.更简单,而且能跨语言.跨平台.你可以把你的数据 ...