Information MySQL database queries and tables

See what database

SHOW databases;

 

Which is used to view the current database, if no database, NULL is returned.

Note: bracketed behind, which is a build in function.

SELECT DATABASE();

 

Use a database

USE DB_Name;

 

What a view inside the database table

SHOW tables;

 

View table structure, that is, there are tables of data types which fields, field ...
The following is a list of pet names.

DESCRIBE pet;

Or abbreviated

DESC pet;

or

SHOW COLUMNS FROM pet;

 

Describle tableName and SHOW the COLUMNS the FROM tableName, the effect is the same.

Only list information table in a column

DESC tableName columnName;

 

Reference documentation, MySQL official website:

Getting Information About Databases and Tables

Guess you like

Origin www.cnblogs.com/majestyking/p/11259142.html