The DDL operation MySql

show database; to see all database 

use mysql; use mysql database
show tables; see all the tables 

show full fields from a table; see this column information table

create database if not exists database name defult charset utf8 collate utf8_general_ci; you create a database
defult charset set the default encoding format
collate set the default character set 

drop database database name; delete the database
----------------- ------------------ create a table --------
Create table table name (
ID int Not null AUTO_INCREMENT,
name VARCHAR (20 is) Not null,
Age char (2) Not null,
Time datetime,
Primary Key (ID)
)
Engine = InnoDB
default charset = utf8;
auto_increment property of the self-energizing == sqlserver identity
primary key (id) set as the primary key table id
engine = innodb engine as set innodb, other types of engines: https://www.cnblogs.com/hider/p/9353202.html
default charset = utf8; character set format UTF8 
---------------------------------------- ---------

drop the table table name;

  alter table Table Field Name Data Type Name add; add fields to the information already exists in the table

  alter table drop table name field name to be deleted; field specifies delete the specified table

 alter table change the old table name field name field type a new name for the new field; field of rename table





 

Guess you like

Origin www.cnblogs.com/daimaxuejia/p/12372204.html