PHP進修之SQL語句疾速入門。本站提示廣大學習愛好者:(PHP進修之SQL語句疾速入門)文章只能為提供參考,不一定能成為您想要的結果。以下是PHP進修之SQL語句疾速入門正文
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;