MYSQL Tutorial



TABLES IN MYSQL


📊 Tables in MySQL

In MySQL, tables are where your data is actually stored. A table is a collection of rows and columns, similar to a spreadsheet. Each row is a record, and each column is a field or attribute.

📁 Example Table: students

ID Name Age Course
1 Amit 20 BCA
2 Sara 22 MBA

🛠️ How to Create a Table

You can create a table in MySQL using the CREATE TABLE command:

CREATE TABLE students (
  id INT AUTO_INCREMENT,
  name VARCHAR(50),
  age INT,
  course VARCHAR(50),
  PRIMARY KEY (id)
);
  

📌 Explanation

  • id INT AUTO_INCREMENT → Creates an auto-incrementing ID column
  • name VARCHAR(50) → Stores names up to 50 characters
  • PRIMARY KEY (id) → Makes id a unique identifier for each row

✅ Tips

  • Use meaningful column names like email, dob, etc.
  • Choose the right data types: INT, VARCHAR, DATE, etc.
  • Always define a primary key.

🌟 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