【MySQL】Basic operation of MySQL! !

  • Create database: capital letters are keywords; options in [] are optional options;
    CREATE DATABASE [IF NOT EXISTS] db_name [create_specification [, create_specification] ...]



    write picture description here
  • Use validation rules when creating libraries

    utf8_general_bin : case sensitive
    utf8_general_ci : case insensitive

  • create table

create table 表名(   
 字段1 列类型1,  
 字段2 列类型2,    
 ...    
 字段n 列类型n );

write picture description here

  • insert data into the table
insert into 表名(字段名1, 字段2, ...) values(values1, value2);

write picture description here

  • View the data in the table
select * from 表名
  • Check the character sets supported by the database
show  charset;

write picture description here

  • View the statement to create the database
show create database 数据库名;

write picture description here

  • delete database
DROP DATABASE [IF EXISTS] db_ name;

For example, delete the test database
write picture description here

  • database modification
 ALTER DATABASE [IF EXISTS] db_name [alter_spacification [,alter_spacification]...]

Note: The modification of the database is mainly aimed at the character set and verification rules of the approval database

write picture description here

  • table modification
ALTER TABLE  tablename ADD (column datatype [DEFAULT expr][,column datatype]...); 

ALTER TABLE  tablename MODIfy (column datatype [DEFAULT expr][,column datatype]...); 

ALTER TABLE  tablename DROP (column);

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324720488&siteId=291194637