2016030207-sql50 Exercises (script)

Source: Internet
Author: User
Tags mysql version

  My MySQL version is 5. The following SQL exercises are the prerequisite scripting code.

--Student (s#,sname,sage,ssex) Student table-Course (c#,cname,t#) Schedule-SC (s#,c#,score) Table-Teacher (t#,tname) Teacher table CREATE table Student (SID Int (4) NOT null primary key auto_increment, sname char () is not NULL, Sage Int (3) is not NULL, Ssex int (    1) NOT NULL for default ' 1 '), CREATE TABLE course (CID int (4) NOT null primary key auto_increment, CNAME char (a) NOT NULL, Tid int (4) not NULL), the CREATE TABLE SC (SID int (4) NOT NULL, CID int (4) is not NULL, score int (3) is not null); CREATE TABLE Teacher (tid int (4) NOT null primary key auto_increment, Tname char (a) not null); INSERT into student values (1, ' Tom ', 25, 1), (2, ' Joan ', 19,0), (3, ' Wang ', 41,1), (4, ' Lucy ', 52,0), (5, ' Lili ', 61,1), insert into teacher values (1, ' liming '), (2, ' Wa Ngshan '), (3, ' Zhangheng '), (4, ' Hushi '), insert into course values (1, ' Java ', 2), (2, ' think ', 3), (3, ' math ', 1), (4, ' Chinese ', 1), (5, ' High Math ', 2); Insert to SC values (1,1,24), (1,2,60), (1,3,70), (1,4,90), (1,5,99); INSERT into SC values (2,1,60 ), (2,2,80), (2,3,60), (2,4,91), (2,5,89) INSERT into SC values (3,1,66), (3,2,78), (3,3,90), (3,4,78), (3,5,90), insert into SC values (4,1,80), (4,2,34), ( 4,3,81), (4,4,56), (4,5,90); INSERT into SC values (5,1,99), (5,2,32), (5,3,45), (5,4,12), (5,5,76);

2016030207-sql50 Exercises (script)

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.