2. Use aliases (AS) for multi-table queries
3. Use WHERE for conditional queries, and try to avoid using HAVING
4. Do not use index columns (select * from emp where sal+ 500>1000 × select * from emp where sal>500 √ )
5. Use IN when specifying the query range (select * from emp where id=1001 or id =1002 × select * from emp where id in (1001,1002) √ )
6. Use TRUNCATE to clear the records in the table
7. Submit transactions in time
8. Use EXISTS and NOT EXISITS statements to judge conditions (select * from emp where deptid in (select id from dept where deptname='Information Department') × select * from emp where deptid exists (select id from dept where deptname='Information Department') √ )
9. Use uppercase letters instead of lowercase letters
10. Try not to use the inequality sign (using the inequality sign will not use the index)
11. Try not to use the NULL keyword to judge empty (IS NULL and IS NOT NULL will not use index query)
12. Use ROWID to remove duplicate values in the table
select name, decode(sex, 0, 'female', 'male') as gender, (case sex when 0 then '女' when 1 then '男' end) as sex ,(case when age>=30 then 'a teacher over 30' when age < 30 then 'a teacher below 30' end )as age from teacher