Home >Database >Mysql Tutorial >How to view the table structure in mysql?

How to view the table structure in mysql?

青灯夜游
青灯夜游Original
2019-06-15 17:20:2669778browse

How to view the table structure in mysql? The following article will introduce to you the commonly used methods to view the mysql table structure. I hope it will be helpful to you.

Mysql method to view the table structure:

1. Use the desc command

Syntax:

desc 表名;

Example: Take the view of student (sid,sname,birthday,sex) as an example

How to view the table structure in mysql?

Use the following command to view the table structure:

desc student;

How to view the table structure in mysql?

2. Use the describe command

Syntax:

describe 表名;

3. Use the show command

The show command can be used in many ways to view the table structure:

Syntax 1:

show columns from 表名;

Syntax 2:

show create table 表名;

Example:

show create table student;

How to view the table structure in mysql?

Grammar 3:

show full fields from 表名;

Example:

show full fields from student;

How to view the table structure in mysql?

## Grammar 4:

show fields from 表名;

Example:

show fields from student;

How to view the table structure in mysql?

The above is the detailed content of How to view the table structure in mysql?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn