Dictionary table to find out the table name, column name, data type, field type in the library

Dictionary table to find out the table name, column name, data type, field type in the library

SELECT
COLUMN_NAME 列名,

COLUMN_COMMENT field description,
 
DATA_TYPE data type,
 
CHARACTER_MAXIMUM_LENGTH length,
 
IS_NULLABLE AS 'NOT NULL',

column_key index type,
 
COLUMN_DEFAULT default value
FROM INFORMATION_SCHEMA. COLUMNS 
WHERE  
table_schema = 'orderdb'
AND
table_name = 'tb_user'

[Table_schema corresponds to the library name, table_name corresponds to the table name]

This statement is very useful when viewing the table structure, especially when writing the table structure, update is 4.10.2020

There is no triplet in the SQL statement -----------: wherea = b = c error

Published 27 original articles · praised 7 · 20,000+ views

Guess you like

Origin blog.csdn.net/qq_36849031/article/details/79126424