accp8.0 Conversion Textbook The 2nd chapter of the first knowledge of MySQL

Source: Internet
Author: User

Install MySQL First:

A. Word part:

①networking network ②option Select ③port Port ④firewall firewall ⑤engine engine

⑥standard Standard ⑦character character ⑧collation Proofing ⑨stirage Storage

Create drop Delete Comment Comment variables variable

Two. Preview section

1. Write out the SQL statement that created and deleted the database

CREATE database name;

DROP database name;

2. Write out SQL statements to create and delete tables

CREATE Table Table name (

field data type constraints,

...,

...

)

DROP TABLE name;

3. View the table

SHOW TABLES;

4. Specify the storage engine for the table

CREATE Table Table name (

.........

) enegine= storage engine;

Three. Practice Section

1. Complete the configuration of MySQL database (ask Niang ... )

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

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

3. Create an Account table using SQL statements

#上机三课程表
DROP DATABASE IF EXISTS ' MySchool ';

CREATE DATABASE MySchool;

Use MySchool;

DROP TABLE IF EXISTS ' subject ';

CREATE TABLE ' Subject ' (

' Subjectno ' INT (4) Not NULL COMMENT ' course number ' auto_increment PRIMARY KEY,

' Subjectname ' VARCHAR (COMMENT ' course name '),

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

' Gradeid ' INT (4) COMMENT ' Grade number '
);

4. On machine 4 Create a score table using SQL statements

#上机四timestamp score Table
DROP TABLE IF EXISTS ' result ';

CREATE TABLE ' Result ' (
' Studentno ' INT (4) is not NULL,
' Subjectno ' INT (4) is not NULL,
' Examedate ' TIMESTAMP not NULL DEFAULT now (),
' Studentresult ' INT (4) Not NULL
);

5. Create student and Grade tables

#上机五学生表和年级表
DROP TABLE IF EXISTS ' student ';

CREATE TABLE ' Student ' (
' Studentno ' INT (4) Not NULL PRIMARY KEY,
' Loginpwd ' VARCHAR (not NULL),
' Studentname ' VARCHAR (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 ' grade ';

CREATE TABLE ' Grade ' (
' Gradeid ' INT (4) Not NULL auto_increment PRIMARY KEY,
' Gradename ' VARCHAR (not NULL)
);

6. Using System Help

Help query content;

Four. Summary section

MySQL's storage engine

Common Storage Engine: Innodb,myisam

InnoDB: Supports transaction processing, foreign keys. Larger footprint than MyISAM, suitable for transactions, updates, deletion of frequent scenes

MyISAM: Transaction and foreign keys not supported, small footprint, fast access, suitable for applications that do not require transaction processing, frequent queries

accp8.0 Conversion Textbook The 2nd chapter of the first knowledge of MySQL

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.