Loading
What is a Table in SQL-tutorial
Before we start writing SQL commands, it is important to understand how data is actually stored inside a database.

Think of a table as a digital version of an Excel sheet it has rows and columns, and each box (cell) stores one piece of data.



What is a Table?

A table in a database is a collection of related data organized in rows and columns.

  • Each row (also called a record) represents a single entry.
  • Each column (also called a field) represents a specific attribute of that entry.


Example

Imagine a table named 'Students' that stores student details.


StudentIDNameAgeCourse
1Nikhil22Java
2Priya21Python
3Rahul23C++



How Data is Stored

When you insert data in a table, you are basically adding a new row. Each row contains values for each column in a specific order.


Real Life Analogy

Just like a student's details in a register

  • Each page = Table
  • Each line = Row
  • Each column header = Attribute like Name, Roll No, Age etc.



Example: Creating a Table in SQL

Here is how we define a table in SQL ( do not worry we will learn each part later )

CREATE TABLE Students (
    StudentID INT,
    Name VARCHAR(50),
    Age INT,
    Course VARCHAR(30)
);


Now, let us insert some data

INSERT INTO Students (StudentID, Name, Age, Course)
VALUES (1, 'Nikhil', 22, 'Java');



Two Minute Drill

  • Table = Data organized in rows and columns
  • Row = One record (like a single person's info)
  • Column = Attribute (like Name, Age)
  • Data stored in a table can be searched, updated and linked easily