MYSQL Tutorial



MYSQL CREATE & DROP TABLE


MySQL: CREATE and DROP TABLE

Tables are where your actual data is stored in a MySQL database. You use the CREATE TABLE command to create a new table, and DROP TABLE to delete a table permanently.

🔹 CREATE TABLE Syntax:

CREATE TABLE table_name (
  column1 datatype constraints,
  column2 datatype constraints,
  ...
);
  

🔹 Example: Create a customers Table

CREATE TABLE customers (
  id INT AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(100) NOT NULL,
  email VARCHAR(100) UNIQUE,
  signup_date DATE
);
  

This creates a table called customers with columns for ID, name, email, and signup date.

🔹 DROP TABLE Syntax:

DROP TABLE table_name;
  

🔹 Example: Drop the customers Table

DROP TABLE customers;
  
Warning: Dropping a table deletes the table and all its data permanently. Use this command carefully!

🌟 Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review