Home > Database > Mysql Tutorial > body text

How to determine whether a mysql field exists

WBOY
Release: 2022-02-15 10:33:01
Original
8377 people have browsed it

Method: 1. Use the desc command, the syntax is "desc table name field"; 2. Use the "show columns" command, the syntax is "show columns from table name like field"; 3. Use the describe command, The syntax is "describe table name field".

How to determine whether a mysql field exists

The operating environment of this tutorial: windows10 system, mysql8.0.22 version, Dell G3 computer.

How to determine whether a mysql field exists

1. desc command

Format: desc tablename columnname

Example:

desc `table` `mid`
desc `table` '%abc%'
Copy after login

2. show columns command

Format: show columns from tablename like columnname

Example:

show columns from `table` like 'mid'
show columns from `table` like '%abc%'
Copy after login

3. describe command

Format: describe tablename columnname

describe is equivalent to show columns from

Example:

describe `table` `mid`
describe `table` '%abc%'
Copy after login

Recommended learning:mysql video tutorial

The above is the detailed content of How to determine whether a mysql field exists. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template