Simple Query for Oracle Learning

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.