"MySQL Getting started is simple" exercise 6.5

Source: Internet
Author: User

First step:win+r input cmd, open command Line window input mysql-h 127.0.0.1-u root-p

The second step: to see if there is a database in the example database if there is a backup and then delete, and then create a database, enter the Create databases example;

In show DATABASES, confirm that the database is created successfully. -

The third step: create student and grade two tables, first use example; To select the example database,

Enter the corresponding SQL statement against the two tables that need to be designed

Creating a table is easy to omit conditions so careful review, I missed the s_num in the table of non-empty properties, is the correct data table after the modification

(1) Change the data type of the course field of the grade table to varchar (20)

(2) Change the position of the S_num field to the front of the course field

(3) rename the Grade field to score

Ps: It is best not to have the same field name as the table name March 29, 2017

(4) Delete foreign KEY constraint for grade table

First look at what foreign keys are included in the table and learn the foreign key names

(5) Change the storage engine of the grade table to the MyISAM type

(6) Remove the Address field from the student table

(7) Add a field named Phone to the student table with the data type int (10)

(8) Change the grade table name to Gradeinfo

(9) Delete student table

"MySQL Getting started is simple" exercise 6.5

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.