Using the table under the Scott user,
1. Query All content
SELECT * from EMP;
2. Query employee information, including employee number, name, position 3 information
SELECT empno,ename,job from EMP;
3. Find All Jobs
SELECT JOB from EMP;
4. Check all positions and remove the re-use distinct
SELECT DISTINCT job from EMP;
5. Check employee number, name, position
SELECT empno,ename,job from EMP;
6. Check all employee's number, name, salary, annual salary sal*12, daily Sal/30; one months 30 days
SELECT Empno,ename,sal,sal*12,sal/30 from EMP;
7. Query all employees, number, name, salary, annual salary sal*12, daily Sal/30; one months 30 days, end of year plus 5000 yuan year-end bonus
SELECT Empno,ename,sal,sal*12+5000,sal/30 from EMP;
8. Query all employees, number, name, salary, annual salary sal*12, daily Sal/30; one months 30 days, year end plus 5000 yuan year-end bonus, each month plus 200 yuan subsidy
SELECT empno,ename,sal, (sal+200) *12+5000,sal/30 from EMP;
9. Query all employees, number, name, monthly salary, annual salary sal*12, daily Sal/30; one months 30 days, the end of the year plus 5000 yuan year-end bonuses, each month plus 200 yuan subsidy and set the table for each result
SELECT Empno as employee number, ename as employee name, Sal as monthly salary, (sal+200) *12+5000 as annual salary, SAL/30 as daily from EMP;
10. Query all employees, number, name, monthly salary, annual salary sal*12, daily Sal/30; one months 30 days, year end plus 5000 yuan year-end bonus, each month plus 200 yuan subsidy and set the table header for each result, and increase the currency row
SELECT Empno as employee number, ename as employee name, Sal as monthly salary, ' RMB ' as currency, (sal+200) *12+5000 as annual salary, ' RMB ' as currency, sal/30 as daily, ' RMB ' as currency from EM P
11. Use | | Make connection display
SELECT ' Employee number: ' | | empno | | ', the employee name is: ' | | ename | | ', the base salary is: ' | | Sal from EMP;
12. Use | | Make a connection display and change the header to employee information:
SELECT ' Employee number: ' | | empno | | ', the employee name is: ' | | ename | | ', the base salary is: ' | | Sal employee information from EMP;
13. Query all employees, number, name, monthly salary, annual salary sal*12, daily Sal/30; one months 30 days, year end plus 5000 yuan year-end bonus, each month plus 200 yuan subsidy and set the table header for each result, and increase the currency row
SELECT Empno as employee number, ename as employee name, Sal as monthly salary, ' RMB ' as currency, (sal+200) *12+5000 as annual salary, ' RMB ' as currency, sal/30 as daily, ' RMB ' as currency from EM P
2015-01-05
Simple Query for Oracle Learning