MySQL – Create, Alter and Delete Tables (Create Table, Alter Table, Drop Table)

Tables are the building blocks of Databases. They store the records for the Database are are easy to create, alter and delete.

  • Use database; – Enter Database
  • Select database(); – Shows what Database you are currently in
  • Show tables; – Shows Tables in Database

Create a Table Example:

Create table users(
user_id INT Auto_INCREMENT PRIMARY KEY,
Name TEXT,
Age INT,
Bio TEXT
);
  • Desc tableName; – Shows Column information for Table

Alter Table Example:

alter table users
add gender text;

alter table users
drop gender;

Be the first to comment

Leave a Reply