where is the error----the MySQL command?
The answer semicolon should be in English environment and not in Chinese;
NOTICES:A: A single quotation mark to be used in a table and a backslash
1. Table creation: Createtabkle table name
(
Type of column name [constraint ],
Type of column name [constraint ],
Type of column name [constraint ],
);
Create a student id,name,age;
CREATE TABLE ' tb_student '
(
' id ' bigint DEFAULT NULL,
' Name ' VARCHAR (DEFAULT NULL),
' Age ' INT (one) DEFAULT NULL
) Engine=innodb DEFAULT Charset=utf8;
2, the constraint of the table:
A, non-null constraint DEFAULT not NULL
B, UNIQUE constraint:unique
Unique the contents of the column in the table must be unique
CREATE TABLE ' tb_student '
(
' id ' bigint DEFAULT NULL,
The ' name ' VARCHAR ( UNIQUE) is not NULL,
' Age ' INT (one) DEFAULT NULL
) Engine=innodb DEFAULT Charset=utf8;
Constraints on the C primary key :
1PRIMARY KEY is non-null and unique
2auto_increment. starting from 1. Step is 1,
The design of a primary key that uniquely identifies a row of data
1: Single Field primary key:
Composite PRIMARY Key
2 primary keys are divided into two types
1, Natural primary key
2, Proxy primary key
CREATE TABLE ' tb_student '
(
' id ' bigint DEFAULT NULL,
The ' name ' VARCHAR (UNIQUE) is not NULL,
' Age ' INT (one) DEFAULT NULL,
Primery KEY (' id ')
) Engine=innodb DEFAULT Charset=utf8;
Constraints on foreign keys
First Operation MySQL