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