SQL Tutorial



ROW COLUMN IN SQL TABLE


πŸ“Š Rows and Columns in SQL Tables

In SQL, a table consists of two major components: rows and columns.

πŸ“ Rows

A row represents a single record or entry in the table. Each row contains data for each column. You can think of it as a horizontal line of values.

Each row is unique and identified by a primary key (e.g., id column).

πŸ“Š Columns

A column represents a single data field in the table. It contains values of the same type across all rows (for example, all name entries in the students table).

Columns are defined by their data types, like INT, VARCHAR, etc.

πŸ“Š Example Table

ID Name Age Grade
1 John 22 A
2 Emma 23 B

In this example, each row represents a student, and the columns represent the student's ID, Name, Age, and Grade.

πŸ’» SQL Query to Access Rows and Columns

You can access a specific row or column in SQL using the SELECT statement. Here’s an example to fetch a specific row based on the id column:


SELECT * FROM students WHERE id = 1;
    

This query will return the row with id = 1 from the students table.

🎯 Try It Yourself!

Can you write an SQL query to select all names of students who are older than 21?

(Test your SQL queries in a SQL editor or database management tool!)


🌟 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