I. GENERAL Enquiry
/* Query table data */
SELECT * FROM STU
/* Remove the first 3 rows of data */
SELECT * from Stu where rownum<=3
/* Fuzzy query */
SELECT * from Stu where stu_id like ' stu001% '
Description: The wildcard "%" represents one or more characters, and the wildcard "_" represents one character.
/* Alias */
Select stu_id as study number from STU
Second, joint inquiry
/* General Union Query */
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU, KC WHERE STU. Kc_no = KC. Kc_no
/* Union query */
SELECT STU. Stu_name, STU. Stu_age, KC. Kc_name from STU INNER JOIN in 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 in 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 JOIN 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 in KC on STU. Kc_no = KC. Kc_no ORDER by STU. stu_id
/*union keyword, Union of two tables some fields */
Select Stu_name from STU UNION SELECT kc_name from KC