Oracle Learning Notes-Query article _oracle

Source: Internet
Author: User
Tags joins

First, the general inquiry

/* Query table Data */
SELECT * from STU

/* Remove the first 3 lines of data/
select * from Stu where rownum<=3 


/* Fuzzy query/
SELECT * from Stu where stu_id like ' stu001% '

Description: The wildcard character "%" represents one or more characters, and the wildcard "_" represents one character.

/* alias */
Select stu_id as learning No. from STU

Ii. Joint Enquiries

* * Common Joint query/
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU, KC where STU. Kc_no = KC. Kc_no


/* Joint Enquiry/
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU INNER joins KC on STU. Kc_no = KC. Kc_no ORDER by STU. stu_id 


/* Left connection */
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU left JOIN KC on STU. Kc_no = KC. Kc_no ORDER by STU. stu_id 


/* Right Connection */
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU right joins KC on STU. Kc_no = KC. Kc_no ORDER by STU. stu_id 


/* Full connection/
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU full JOIN KC on STU. Kc_no = KC. Kc_no ORDER by STU. stu_id 


/*union keyword, combining two table certain fields * *
select stu_name from STU UNION select Kc_name from KC

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.