Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of querying all fields of table words in mysql

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the method of querying all fields of table words in mysql. I hope you will gain a lot after reading this article. Let's discuss it together.

Mysql query table word all fields method: use "SHOW FROM" statement with FULL keyword to query, syntax "SHOW FULL COLUMNS FROM table_name", you can display all the field information of the specified data table.

Mysql query table word all fields

1. View all table names:

Show tables [from db_name]

2. View field information

SHOW FULL COLUMNS FROM table_name

Get the following information

Field: field name

Type: field typ

Collation: character set (mysql 5.0 or above)

Null: whether it can be NULL

Key: index (PRI,unique,index)

Default: default

Extra: extra (auto_increment or not)

Privileges: permission

Comment: remarks (mysql 5.0 or above)

Mysql > create table teacher # create teacher Table-> (- > Id int (5) auto_increment not null primary key,-> name char (10) not null,-> address varchar (50) default 'No.1 Mid school',-> year date->); Query OK, 0 rows affected (0.02 sec) mysql > show tables +-+ | Tables_in_school | +-+ | teacher | +-+ 1 row in set (0.00 sec) mysql > show full columns from teacher # display all fields of teacher table +-+- -+-+ | Field | Type | Collation | Null | Key | Default | Extra | Privileges | Comment | +-- -+-- +-+ | Id | int (5) | NULL | NO | PRI | NULL | auto_increment | select Insert,update,references | name | char (10) | latin1_swedish_ci | NO | | NULL | | select,insert,update,references | | address | varchar (50) | latin1_swedish_ci | YES | | No.1 Mid school | | select,insert,update References | | year | date | NULL | YES | | NULL | | select,insert,update References | | +-- -+-+ 4 rows in set (0.01sec) mysql > drop table teacher # delete teacher table Query OK, 0 rows affected (0.03 sec) mysql > show tables;Empty set (0.00 sec) mysql > after reading this article, I believe you have a certain understanding of mysql query table word all fields, want to know more related knowledge, welcome to follow the industry information channel, thank you for reading!

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report