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过程中,需要用得到的一些语句。比较简单的大家一定要掌握啊。
延伸 · 阅读
- 2022-03-10简单谈谈centos7中配置php
- 2022-03-06Ubuntu14.04服务器环境下配置PHP7.0+Apache2+Mysql5.7的方
- 2022-03-05centos yum php 7.x 无需删除升级的方法
- 2022-03-05Centos7下PHP安装gd库的实例讲解
- 2022-03-03linux环境下安装PHP的OpenSSL扩展的方法讲解
- 2022-02-27CentOS 7.x编译安装Nginx1.10.3+MySQL5.7.16+PHP5.2 5.3 5.4
- Mysql
MySQL启动报错问题InnoDB:Unable to lock/ibdata1 error
这篇文章主要介绍了MySQL启动报错问题InnoDB:Unable to lock/ibdata1 error,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要...
- Mysql
数据库管理,不能没有这5个MySQL GUI工具
MySQL的数据库管理工具非常多,有哪些优秀的GUI工具可以帮助提高工作效率?不妨看一看这5个MySQL GUI工具...
- Mysql
清理Mysql general_log的方法总结
在本篇文章里小编给大家分享的是一篇关于清理Mysql general_log的相关知识点,需要的朋友们学习下。...
- Mysql
幻读为什么会被 MySQL 单独拎出来解决?
所谓幻读,即一个事务在前后两次查询同一个范围的时候,后一次查询看到了前一次查询没有看到的行,这个回答估计大伙儿已经背烂了,但是它具体有什...
- Mysql
win10 64位 MySQL8.0下载和安装教程图解
这篇文章主要介绍了MySQL下载和安装 win10 64位 MySQL8.0的教程图解,本文图文并茂给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下...
- Mysql
MySQL教程彻底学懂存储过程
这篇文章主要为大家介绍了MySQL系列的存储过程,文中详细的为大家解释存储过程的相关概念及用法语法,以及对存储过程的理解解析,有需要的朋友可以...
- Mysql
mysql数据库备份及恢复命令 mysqldump,source的用法
mysql数据库备份及恢复命令 mysqldump,source的用法,需要的朋友可以参考下。 ...
- Mysql
mysql 5.6.17 绿色版(免安装)安装配置教程
这篇文章主要为大家详细介绍了mysql 5.6.17 绿色版(免安装)安装配置教程,感兴趣的小伙伴们可以参考一下...