Mysql 学习之路(二)Mysql基础知识之简单查询
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Mysql 学习之路(二)Mysql基础知识之简单查询,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1510字,纯文字阅读大概需要3分钟。
内容图文
![Mysql 学习之路(二)Mysql基础知识之简单查询](/upload/InfoBanner/zyjiaocheng/524/423aa441f8f342aeb218651cea3fc4f3.jpg)
1.查询单个字段
select last_name from employees;
2.查询多个字段
select last_name,salary,email from employees;
3.查询所有字段
select * from employees;
4.查询常量值
select 100;
select "john";
5.查询表达式
select 100*90;
6.查询函数;
select version();
7.字段起别名
select lase_name as “姓”,first_name as "名" from employees;
8.去重
select DISTINST department_id from employees;
9.字段连接
select CONCAT(last_name,first_name) as "姓名" from employees;
10.条件查询
select * from employees where salary>12000;
select last_name,department_id from employees where department_id != 90;
select last_name,department_id from employees where salary>10000 and salary<20000;
like:
SELECT * FROM employees where last_name LIKE ‘%a%‘;(模糊查询,%包括任意多个字符,_为任意单个字符,\为转义符号)
SELECT * FROM employees where last_name LIKE ‘__e%‘;
between and
select * from employees where employee_id BETWEEN 100 and 120;
in
select * from employees where job_id in ("IT_PROT","AD_VP","AD_PRES");
is null
SELECT last_name commission_pct from employees where commission_pct is null;
SELECT last_name commission_pct from employees where commission_pct is not null;
安全等于
SELECT last_name commission_pct from employees where commission_pct <=> null;
Mysql 学习之路(二)Mysql基础知识之简单查询
标签:转义 条件查询 pre on() 基础 iss mys 姓名 sql
本文系统来源:https://www.cnblogs.com/peterWXM/p/12989832.html
内容总结
以上是互联网集市为您收集整理的Mysql 学习之路(二)Mysql基础知识之简单查询全部内容,希望文章能够帮你解决Mysql 学习之路(二)Mysql基础知识之简单查询所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。