当前位置:网站首页>MySQL query data
MySQL query data
2022-07-18 14:02:00 【Smile and look at each other silently】
Arithmetic expressions in queries
Use data operators to create expressions for numbers and date data
Operator precedence
MySQL Alias in
Use column aliases
SELECT Name AS Column alias FROM Table name WHERE Conditions ;
MySQL Remove duplicates from
Remove the same lines
stay select Clause distinct Keywords go out on the same line
SELECT Name AS Column alias FROM Table name WHERE Conditions ;
MySQL Comparison conditions in
Other comparison conditions
Use between Conditions
Inquire about employees surface , Salary in 3000-8000 Between employees ID、 Name and salary .
select employee_id,last_name,salary fromemployees where salary between 3000 and 8000;
Use in Conditions
Inquire about employees surface , Find out the salary is 5000,6000,8000 Of employees ID、 Name and salary .
select employee_id,last_name,salary fromemployees where salary between 3000 and 8000;
Use like Conditions
Inquire about employees The second letter of the employee's name is e Employee's name .
select last_name from employees wherelast_name like '_e%';
Use null Conditions
NULL Conditions , Include IS NULL Conditions and IS NOT NULL Conditions .
find emloyees Those employees in the table who have no Commission ID、 Name and Commission .
select employee_id,last_name,commission_pctfrom employees where commission_pct is null;
find employees Those employees who have commissions in the table ID、 Name and Commission .
select employee_id,last_name,commission_pct from employees where commission_pct is not null;
Logical conditions
Inquire about employees The employee name in the table does not contain u The name of the employee .
select last_name from employees where last_name not like '%u%';
The priority rule
Use parentheses to change the priority rule
Use order by Sort
If used ORDER BY Clause , It has to be in SQL At the end of the sentence .
SELECT The execution order of the statements is as follows :
- FROM Clause
- WHERE Clause
- SELECT Clause
- ORDER BY Clause
Inquire about employees All employees in the table , Show their ID、 Name and salary , And sort by salary in ascending order . select employee_id,last_name,salary from employees order by salary asc;
Multi column sorting
Display in ascending order DEPARTMENT_ID Column , At the same time, it is displayed in descending order SALARY Column .
select department_id,salary from employees order by department_id asc ,salary desc;
边栏推荐
- iptables屏蔽ip某个端口访问
- Use case interpretation: openinstall multi scenario application analysis
- phpmyadmin 4.8.1远程文件包含漏洞之[GWCTF 2019]我有一个数据库
- 【目标跟踪】基于背景消减的图像帧间差分法目标检测及matlab仿真
- SimpleDateFormat 的线程安全问题与解决方案
- kettle版本8.2的中文乱码问题
- Mysql 问题
- About XML files (V)
- 2.4_ 9 MySQL by separator, row to column
- Optimization design of video processing and codec hardware system
猜你喜欢

Box model, document flow, positioning, layout and responsive design

Sword finger offer19 regular expression matching string dynamic programming

Les employés de Tencent postent pour trouver des objets, ce qui indique une préférence pour les programmeurs! Les commentaires sont en feu... 丨 Black Horse Headlines

PMP每日一练 | 考试不迷路-7.15

职场必备 | 123页华为内部项目管理PPT

基于SSH的网上商城

What points should be paid attention to in the selection of project management system?
![[phase locked loop] design and Simulation of all digital phase locked loop based on MATLAB](/img/3c/9fe4aec90506cef4bf0a639366263d.png)
[phase locked loop] design and Simulation of all digital phase locked loop based on MATLAB

Install MySQL 5.7.23 in Linux
![ORA-600:[qertbGetPartitionNumber:qesma2],[],[],[]](/img/08/5c9a27c0b488f76e3815ce76047082.png)
ORA-600:[qertbGetPartitionNumber:qesma2],[],[],[]
随机推荐
marginalization
Three lines (spring daily question 59)
PMP每日一练 | 考试不迷路-7.14
解道--探索术
The version of NPM does not match that of node. When the NPM result is updated, an error is reported. How can the previous NPM version be returned? Or how to check the NPM version of node adaptation
MySQL常用查询
二叉搜索树BST
SSH based online mall
CI(持续集成)、CD(持续部署)
总结与归纳:深度神经网络中的数据融合方法
ORA-600:[qertbGetPartitionNumber:qesma2],[],[],[]
Matlab机械臂建模运动学仿真+轨迹规划
PMP practice once a day | don't get lost in the exam -7.15
phpmyadmin 4.8.1远程文件包含漏洞之[GWCTF 2019]我有一个数据库
【目标跟踪】基于背景消减的图像帧间差分法目标检测及matlab仿真
二叉树,遍历
应用打包及多端兼容总结
ping 命令还能这么玩?
Audio focus arbitration strategy
T100debug操作记录