In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you instructions and remarks on how to read the fields in the table under MySQL. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
After running the following table statement under MySQL. How to retrieve the information about the fields of this table from the data dictionary?
DROP TABLE IF EXISTS test_table
CREATE TABLE test_table (
Test_ID int NOT NULL AUTO_INCREMENT PRIMARY KEY COMMENT 'primary key (self-growing)'
Test_Key varchar (10) NOT NULL COMMENT 'species'
Test_Value varchar (20) NOT NULL COMMENT 'Numeric'
Test_Type int NOT NULL COMMENT 'Internal Type'
Test_BelongTo int COMMENT 'dependency'
Test_Grade int DEFAULT 1 COMMENT 'Rank'
Test_Remark varchar (50) COMMENT 'remarks'
Test_Visible bit DEFAULT 1 COMMENT 'visible'
)
COMMENT = 'test table'
The answer is:
SELECT
Column_name AS `column name`
Data_type AS `data type`
Character_maximum_length AS `character length `
Numeric_precision AS `digit length `
Numeric_scale AS `number of decimal places
Whether is_nullable AS `allows non-null nulls
CASE WHEN extra = 'auto_increment'
THEN 1 ELSE 0 END AS `whether self-increment or not
Column_default AS `default value `
Column_comment AS `remarks'
FROM
Information_schema.columns
WHERE
Table_Name='test_table'
The above is the description and remarks on how to read the fields in the table under MySQL shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.