Oracle Complex query (student scores)

Source: Internet
Author: User


There is a relational database with three basic tables. The table structure is as follows: table 1 student no. stu_id name age gender No. depart_id Table 2. SC student no. stu_id course No. course_code score Table 3. course
Www.2cto.com course No. course_code Course name course_name: Number of course hours course_hour1. Compile an SQL statement to query the student ID, name, course name, and score of a student whose number is 990020.
2. Compile an SQL statement to query the query results of a student whose student ID is 014206202216 years older than the student ID.
Student ID, name, age.
3. Search for the department number, student ID, name, lowest score, and highest score of the students whose elective courses are more than 10,
The average score and the total number of courses selected. The results are sorted by the system number and average score (in descending order ).
4. Please use the SQL language to search for at least the courses selected by students whose student ID is 014206202217
Student ID and name for all courses. [Answer] www.2cto.com (1) select a. stu_id, a. name, B. course_name, c. score from student a, course
B, SC c where a. stu_id = c. stu_id and c. course_code = B. course_code
And a. depart_id = 990020; (2) select stu_id, name, age from student where age> = 1 + (select age from
Student where stu_id = 014206202216); (3)

(4) www.2cto.com

[Note] for the complete SQL statement code used in this article, please download the attachment!

Http://up.2cto.com/2013/0206/20130206015802463.rar
 

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.