时间:2021-05-24
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;
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
推荐阅读:MyBatis入门学习教程(一)-MyBatis快速入门什么是动态SQL?动态SQL有什么作用? 传统的使用JDBC的方法,相信大家在组合复
本文实例讲述了Mysql数据库之sql基本语句。分享给大家供大家参考,具体如下:SQL基本语句1.登录退出及快捷键:(1)快捷键:————快速回到行首ctrl+
python入门之语句,包括if语句、while语句、for语句,供python初学者参考。//if语句例子name='peirong';ifname=='pe
本文实例讲述了Mysql数据库之常用sql语句。分享给大家供大家参考,具体如下:前面讲述了Mysqlsql基本语句。这里继续总结一下SQL语句的进阶内容。SQL
最简单的php语句把数据库*.sql文件导入数据库复制代码代码如下:$sql=file_get_contents("text.sql");//把SQL语句以字符