MySQL how the display field, as well as show and use

A list display field

show columns

from table_name;

About use and show

Original link: https://blog.csdn.net/rex_wust/article/details/80409444

When you initially connect to MySQL, there is no database open for you to use. Before you can perform any database operations, you need to select a database.

To do this, use the USE keyword.

 PS key (key word) as a reserved word MySQL language part of the composition. Never use keywords to name a table or column

(1) returns a list of available databases, enter:

SHOW DATABASES;

(2) In order to use crashcourse database, you should enter the following:

 USE crashcourse;

 

Remember, you must first open the USE database in order to read the data.

 

List (3) returns the currently selected database of available tables, may be used

SHOW TABLES; 

In the present embodiment, showing the table in the database crashcourse:

 

(4) SHOW table columns may be used to display, enter:

SHOW COLUMNS FROM customers;

 

SHOW COLUMNS required to give a table name (FROM customers in this example), it returns a row for each field, the row contains the field name, data

Types, whether to allow NULL, the key information, default values, and other information (e.g., the field cust_id auto_increment).

Guess you like

Origin www.cnblogs.com/WildSky/p/11617616.html