< Create data tables >
1. Null and non-empty
null field can be NULL NOT NULL cannot be empty
2.auto_increment
AutoNumber , must be used with primary key, by default, starting value is 1, each increment is 1
3.PRIMARY KEY
PRIMARY KEY constraint, there is only one primary key in each data table, the primary key guarantees the uniqueness of the record, and the primary key is automatically not NULL "is not necessarily used with auto_increment"
4.QUIQUE KEY
Unique constraints, UNIQUE constraints guarantee the uniqueness of a record, a field with a unique constraint can be a null value [NULL], multiple UNIQUE constraints can exist for each data table
5.DEFAULT
Default value, which is automatically assigned to the default value when the record is inserted without explicitly assigning a value to the field
CREATE TABLE [IF not EXISTS] table_name (
field FirstName Property [not NULL] auto_increment PRIMARY KEY,
field FirstName Property [not NULL] UNIQUE KEY,
Field FirstName Property Default ' defaults ',
)
</Creating data Tables >
< summary >
</Summary >
< constraints >
</Constraints >
< foreign KEY Constraints >
</FOREIGN KEY Constraint >
< referential actions for foreign KEY constraints >
</FOREIGN KEY constraint the reference Operation >
< table-level constraints and column-level constraints >
</ table-level constraints and column-level constraints >
< View data Table list >
SHOW TABLES [FORM db_name] [like ' DSAS ' | WHERE EXPT];
</View data Sheet list >
< View data sheet information >
Show CREATE DATABASE tablename;
</View data sheet information >
< View data sheet structure >
show columns from table_name;
</View data table structure >
< inserting records >
insert [INTO] table_name (field name, Field Name 2, Field 3 ...) VALUES (' Val1 ', ' val2 ', ' val3 ' ...);
</inserting records >
< find records >
Select {Field name | *} from tablename;
</Find Records >
Re-learning MySQL data sheet (ii)