Accp8.0 conversion material chapter 2nd first recognized MySQL, accp8.0mysql

Source: Internet
Author: User

Accp8.0 conversion material chapter 2nd first recognized MySQL, accp8.0mysql

First install MySQL:

I. Word Section:

① Networking network ② option selecting ③ port ④ firewall ⑤ engine

⑥ Standard 7character character collate collation proofreaders stirage Storage

Create drop Delete comment variables variable

Ii. Preview

1. Write the SQL statement for creating and deleting databases.

Create database name;

Drop database name;

2. Write SQL statements for creating and deleting tables.

Create table Name (

Field data type constraints,

...,

...

)

Drop table name;

3. view the table

Show tables;

4. Storage engine of the specified table

Create table Name (

.........

) ENEGINE = storage engine;

Iii. Exercises

1. Complete the configuration of the MySQL database ...)

2. Use the command line to connect to MySQL and operate the database

Mysql-h server address-u user name-p Password

3. Use SQL statements to create a subject

# Course schedule
Drop database if exists 'myschool ';

Create database myschool;

USE myschool;

Drop table if exists 'subobject ';

Create table 'subobject '(

'Subjectno' INT (4) not null comment' course No. 'auto_increment primary key,

'Subjectname' VARCHAR (50) comment' course name ',

'Classhour' INT (4) comment' hours ',

'Gradeid' INT (4) comment' Grade No'
);

4. Machine 4. Use SQL statements to create an external table

# Machine four timestamp tables
Drop table if exists 'result ';

Create table 'result '(
'Studentno' INT (4) not null,
'Subjectno' INT (4) not null,
'Examedate' timestamp not null default now (),
'Studentresult' INT (4) NOT NULL
);

5. Create a student table and grade Table

# Machine five student table and grade Table
Drop table if exists 'student ';

Create table 'student '(
'Studentno' INT (4) not null primary key,
'Loginpwd' VARCHAR (20) not null,
'Studentname' VARCHAR (50) not null,
'Sex 'CHAR (2) not null,
'Gradeid' INT (4) UNSIGNED,
'Phone' VARCHAR (50 ),
'Address' VARCHAR (255 ),
'Borndate' DATETIME,
'Eamil 'VARCHAR (50 ),
'Identitycard' VARCHAR (18)
);

Drop table if exists 'grad ';

Create table 'grade '(
'Gradeid' INT (4) not null AUTO_INCREMENT primary key,
'Gradename' VARCHAR (50) NOT NULL
);

6. Use System Help

HELP query content;

Iv. Summary

MySQL storage engine

Common storage engines: InnoDB and MyISAM

InnoDB: supports transaction processing and Foreign keys. It occupies a larger space than MyISAM and is suitable for scenarios that require frequent transaction processing, updates, and deletions.

MyISAM

Welcome to error correction. Welcome to exchange and learn. Thank you! For the original article in the blog Park, contact us for deduction: 2265682997

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.