ORACLE SQL Exercise (vi)

Source: Internet
Author: User

--Use a subquery to find an indeterminate value


--Sub-query and select statement

SELECT e.emp_id, E.first_name, E.last_name, EP. Pay_rate

From Employee_tbl E, Employee_pay_tbl EP

WHERE e.emp_id = EP. emp_id

and EP. Pay_rate <

(SELECT pay_rate from employee_pay_tbl WHERE emp_id = ' 443679012 ');


The following statement is used as a subquery in a later example

SELECT pay_rate from employee_pay_tbl WHERE emp_id = ' 220984332 ';



--sub-query and insert statement


The--insert statement inserts the results returned by the subquery into another table

INSERT into Rich_employees

SELECT e.emp_id, E.last_name, E.first_name, EP. Pay_rate

From Employee_tbl E, Employee_pay_tbl EP

WHERE e.emp_id = EP. emp_id

and EP. Pay_rate >

(SELECT pay_rate from employee_pay_tbl WHERE emp_id = ' 220984332 ');


--sub-query and UPDATE statement


--The subquery is used in conjunction with the UPDATE statement to update one or more fields in a table


Not to be continued ....

This article from "Technology Station" blog, declined reprint!

ORACLE SQL Exercise (vi)

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.