MySQL tables and fields

Database import
File storage data, multiple files are placed in a folder for unified management system
Database classification
mysql installation and use
basic operation of database create show use drop
Basic operation of table create show desc drop
Basic operation of record insert into delete from update set select from

Today’s content
Remaining operation of database and table
Code Introduction to the configuration engine
Operation of database fields
Data types of database
Constraints of database fields

Database configuration is configured through configuration files for the purpose of unified management server mysqld client client configuration If the encoding of the mysqld server is utf8, then the default encoding of the re-created database adopts the modification of utf8 table alter table old table rename new table modify field name alter table table name change old field new field type (length) modify field attribute alter table table name modify field new type (length) complete grammar for table creation create table table name (attribute name type (length) constraint) database table engine create tale t11(id int) engine = xxx data type type supported by mysql tinyint 1 byte- 128~ smallint 2 bytes -32768 ~ 32767 mediumint 3 bytes int 4 bytes -21324235~3 bigint 8 bytes constraint unsigned unsigned zerofill 0 fill table creation mysql>: insert into tb1 values(128,32768,3768); Result 127 32767 32768 Conclusion The length of the integer type is determined by the value range of the byte occupied. The length can be customized but does not affect the value range of the byte occupied. The length of all integer variables is generally omitted. Create table tb2(x tinyint unsigned ); insert into tb2 values(256),(-1); create table tb3 (x tinyint unsigned zerofill); insert into tb3 values(10); Enumeration and collection Enumeration and collection are provided for a certain field The enumeration of options can only select 1 set, and you can select multiple 0-n table enum sets. The default value is NULL create table tc1 (name varchar(20),sex enum(‘male’,’female’,’wow’) ),hobbies set(‘male’,’female’,’wow’)) insert into tc1 values(‘ruaki’,’wowwow’,’unknown’);

Leave a Comment

Your email address will not be published.