π Rows and Columns in MySQL
In a MySQL table:
- πΉ Columns define the structure β they are the fields like
id
, name
, age
.
- πΉ Rows are the records β each row contains values for each column.
π Example: students
Table
ID |
Name |
Age |
City |
1 |
Amit |
21 |
Delhi |
2 |
Riya |
23 |
Mumbai |
π§© Understanding Columns
- Columns are like headers in Excel.
- Each column has a name and a data type.
- Example:
name VARCHAR(50)
β column for names up to 50 characters.
π§© Understanding Rows
- Rows hold the actual data.
- Each row is a full record (like 1 studentβs data).
- Rows are added using the
INSERT INTO
statement.
π οΈ Insert Example (Row)
INSERT INTO students (name, age, city)
VALUES ('Suman', 22, 'Bangalore');
π‘ Tip: You define columns when creating the table. You insert rows later as data.