MySQL database operations, data types, table operations

Table of contents

1. Database operations

(1), display database

(2) Create database

(3) Delete the database

(4), use database

2. Common data types

(1), numerical type

(2), string type

(3), date type

3. Table operations

(1), create table

(2), view table

(3) Delete table

You’ve all seen this, give it a thumbs up and go away, thank you, thank you! ! !


1. Database operations

Note: MySQL is not case-sensitive, so when we enter the code, we can enter it in uppercase or lowercase.

(1), display database

语法:SHOW DATABASES;

Code display:

     

(2) Create database

Syntax:CREATE DATABASE [IF NOT EXISTS] Database name;

Code display:

(3) Delete the database

语法DROP DATABASE [IF EXISTS] 数据库名

[IF EXISTS] is optional. If the database name exists, it will be deleted. If not, it will not be deleted, and the program will not report an error. )

Code display:

(4), use database

Language:USE Numerical name

Code display:


2. Common data types

(1), numerical type

Numeric types can also be specifiedunsigned types (unsigned), means not taking negative numbers.

(2), string type

(3), date type


3. Table operations

(1), create table

Syntax:CREATE TABLE table name (column name type, column name type...);

Code display:

(2), view table

Language:DESC table name

Code display:

(3) Delete table

语法:DROP TABLE [IF EXISTS] 表名

[IF EXISTS] is optional. If the table name exists, it will be deleted. If not, it will not be deleted, and the program will not report an error. )

Code display:


You’ve all seen this, give it a thumbs up and go away, thank you, thank you! ! !

Guess you like

Origin blog.csdn.net/cool_tao6/article/details/134095316