Database Pen Questions

Source: Internet
Author: User

1.

Student table: Student Student Table (school number, name, gender, age, Organization Department)

Course Curriculum (number, course name)

Sc Selected timetable (school number, course number, score)

The table structure is as follows:

(1). Write an SQL statement, query the "Computer principle" student number and name

(2). Write an SQL statement that queries the ' Stephen Chow Chi ' class name

(3). Write an SQL statement that queries the student number and name of 5 courses

(1)

Select sno,sname              from  student              where  sno in  (                             select sno                              from sc                              where cno =  (                                            select cno                                            from  course                                            where cname= ' Principles of computer '                                              )                               ) 

  (2)            

Select cname              from  course              where cno  in  (                             select cno                             from sc                              where sno =                                      (                                         select sno                                        from student                                         where sname= ' Stephen Chow Chi '                             )                                     ) 

(3)           

Select Sno,sname from Student Where Sno in (select Sno From SC GROUP by SNO have Count (Sno) =5)


This article is from a "stroll," blog, please be sure to keep this source http://macxiao.blog.51cto.com/9606147/1589170

Database Pen Questions

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.