Check the Schema of a table in MySQL Example
Let us look at an example, where we will check the schema of a table in MySQL.
First, let’s create a database and demo table.
Query:
CREATE DATABASE w3wikiDatabase;
USE w3wikiDatabase;
CREATE TABLE Geeks (
GeekID INTEGER PRIMARY KEY,
GeekName VARCHAR(255) NOT NULL,
GeekRank INTEGER NOT NULL,
GeekSchool VARCHAR(255) NOT NULL
);
Display the table structure (Schema) in MySQL
Here is the MySQL query to display the table schema
Query:
DESCRIBE w3wikiDatabase.Geeks;
Output:
How to Show Schema of a Table in MySQL Database?
A table schema in MySQL database defines the structure of table, including columns, data types, relationships between columns, etc. It is a blueprint for the table, describing how data is organized in the table and how it relates to other tables in the database.
To see the schema of a table in MySQL database, use the DESCRIBE command.