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过程中,需要用得到的一些语句。比较简单的大家一定要掌握啊。
延伸 · 阅读
- 2019-11-06Oracle 常用的SQL语句
- 2019-11-06安装配置php-fpm来搭建Nginx+PHP的生产环境
- 2019-11-06php递归实现无限分类生成下拉列表的函数
- 2019-11-06php用数组返回无限分类的列表数据的代码
- 2019-11-06php自定义函数之递归删除文件及目录
- 2019-11-06php自动获取目录下的模板的代码
精彩推荐
- Mysql
Mysql如何适当的添加索引介绍
今天小编就为大家分享一篇关于Mysql如何适当的添加索引介绍,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,需要的朋友一起跟随小编...
- Mysql
MySQL两种表存储结构MyISAM和InnoDB的性能比较测试
MySQL支持的两种主要表存储格式MyISAM,InnoDB,上个月做个项目时,先使用了InnoDB,结果速度特别慢,1秒钟只能插入10几条。后来换成MyISAM格式,一秒钟插入...
- Mysql
Starting MySQL.Manager of pid-file quit without updating file.[FAILED]的解决方法
因为硬盘满了,Starting MySQL.Manager of pid-file quit without updating file.[FAILED] ...
- Mysql
使用MySQL的geometry类型处理经纬度距离问题的方法
这篇文章主要介绍了使用MySQL的geometry类型处理经纬度距离问题的方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧...
- Mysql
MySQL按时间统计数据的方法总结
在本篇MYSQL的内容里,我们给大家整理了关于按时间统计数据的方法内容,有需要的朋友们学习下。...
- Mysql
mysql 记录不存在时插入 记录存在则更新的实现方法
mysql 记录不存在时插入 记录存在则更新的实现方法,相信很多人都需要用到这个语句,请看下文:(在4.1以后的版本才有效) ...
- Mysql
MySQL 数据类型和建库策略
无论是在小得可怜的免费数据库空间或是大型电子商务网站,合理的设计表结构、充分利用空间是十分必要的。这就要求我们对数据库系统的常用数据类型...
- Mysql
汇总整理MYSQL相关操作命令
本文汇总了一些常用的mysql命令。 ...