Select * from tablename
SQL> select * from employees;
Select select list from tablename
SQL> select employee_id,first_name from employees;
Select distinct … from tablename
SQL> select distinct manager_id from employees;
||连接符使用以及 加减乘除以及括号的使用
SQL> select employee_id,first_name||'.'||last_name,salary*(1+0.1)/100,manager_id
2 from employees;
+-做正负号使用
SQL> select -salary from employees;
<>,>,<,=,!=等比较操作符
SQL> select * from employees where salary >13000;
SQL> select * from employees where salary <13000;
SQL> select * from employees where salary <>13000;
SQL> select * from employees where salary =13000;
In
SQL> select -salary from employees where employee_id in (100,101,102);
SQL> select -salary from employees where employee_id in (select employee_id from employees);
not in
SQL> select -salary from employees where employee_id not in (100,101,102);
Any(比任意一个都)
select * from employees where employee_id >any(100,101,102);
some 是 SQL-92 标准的 any 的等效物
select * from employees where employee_id >any(100,101,102);
all(比所有的都)
select * from employees where employee_id >all(100,101,102);
between and
select * from employees where employee_id between 100 and 102;
not between and
select * from employees where employee_id not between 100 and 102;
逻辑操作符
And 和 or
select * from employees where employee_id > 100 and employee_id < 1000;
select * from employees where employee_id > 100 or employee_id < 1000;
Order by
Desc
select * from employees where employee_id between 100 and 102 order by employee_id desc;
Asc
select * from employees where employee_id between 100 and 102 order by employee_id asc;
dual哑元表没有表需要查询的时候可以用它
select sysdate from dual;
select 1*2*3*4*5 from dual;
PHP学习之SQL语句快速入门
2019-11-06 13:46mysql教程网 Mysql
在学校php过程中,需要用得到的一些语句。比较简单的大家一定要掌握啊。
延伸 · 阅读
- 2024-10-30PHP文件上传源码分析(RFC1867) - php上传下载
- 2024-10-30php 异步上传图片几种方法总结 - php上传下载
- 2024-10-30php iframe实现无刷新文件上传 - php上传下载
- 2024-10-30php支持分块与断点续传文件下载功能代码 - php上
- 2024-10-30php中检测上传文件类型与上传图片大小代码 - p
- 2024-10-30php文件下载实例 - php上传下载
- Mysql
Centos7下使用yum安装mysql数据库的详细教程(增强版)
这篇文章主要介绍了Centos7下使用yum安装mysql数据库的详细教程(增强版),非常不错,具有参考借鉴价值,需要的朋友可以参考下 ...
- Mysql
MySQL全文索引、联合索引、like查询、json查询速度哪个快
这篇文章主要介绍了MySQL全文索引、联合索引、like查询、json查询速度大比拼,通过实例代码截图的形式给大家介绍的非常详细,具有一定的参考借鉴价值...
- Mysql
几种MySQL中的联接查询操作方法总结
这篇文章主要介绍了几种MySQL中的联接查询操作方法总结,文中包括一些代码举例讲解,需要的朋友可以参考下 ...
- Mysql
MySQL锁的知识点总结
在本篇文章里小编给大家整理了关于MySQL锁的知识点总结以及实例内容,需要的朋友们学习下。...
- Mysql
解决重置Mysql root用户账号密码问题
这篇文章主要介绍了解决重置Mysql root用户账号密码问题,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...
- Mysql
MySQL之Field‘***’doesn’t have a default value错误解决办法
这篇文章主要介绍了MySQL之Field‘***’doesn’t have a default value错误解决办法,需要的朋友可以参考下 ...
- Mysql
MySQL 查询速度慢与性能差的原因与解决方法
随着网站数据量与访问量的增加,MySQL 查询速度慢与性能差的问题就日渐明显,这里为大家分享一下解决方法,需要的朋友可以参考下...
- Mysql
MySQL server has gone away错误提示解决方法
今天遇到类似的情景,MySQL只是冷冷的说:MySQL server has gone away。 ...