Tables — Complete Guide
Tables — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of SQL Server Tutorial on Toolliyo Academy.
On this page
SQL Server Tutorial · Lesson 8 of 100
Tables
SQL basics → Queries → Advanced
SQL basics · 1 — SELECT · ~6 min · SQL — Foundations
What is this?
A table is a named set of rows and columns. CREATE TABLE defines columns; INSERT adds rows; SELECT reads them.
Why should you care?
Every business entity — Customer, Order, Product — becomes a table so the API can store and query it.
See it live — copy this example
Run in SQL Server Management Studio (SSMS) or Azure Data Studio.
USE DataVerse;
IF OBJECT_ID(N'dbo.Customers', N'U') IS NOT NULL DROP TABLE dbo.Customers;
CREATE TABLE dbo.Customers (
CustomerId INT IDENTITY(1,1) NOT NULL PRIMARY KEY,
FullName NVARCHAR(100) NOT NULL,
Email NVARCHAR(256) NOT NULL,
CreatedAt DATETIME2(0) NOT NULL
CONSTRAINT DF_Customers_CreatedAt DEFAULT (SYSUTCDATETIME())
);
INSERT INTO dbo.Customers (FullName, Email)
VALUES (N'Priya Shah', N'priya@example.com');
SELECT * FROM dbo.Customers;
What happened?
- IDENTITY makes CustomerId auto-number.
- DEFAULT stamps CreatedAt in UTC.
- One INSERT then SELECT proves the table works.
Practice next
- Run the script in your database.
- Expand Tables in Object Explorer and refresh.
- Insert a second customer with a different email.
- Add Phone NVARCHAR(20) NULL and insert with a phone.
- Try inserting NULL FullName and read the error.
Remember
Tables store rows of related columns. IDENTITY + PRIMARY KEY is a common key pattern. INSERT then SELECT verifies the design.
DataVerse customer master
The shop API creates dbo.Customers on day one of the schema.
Outcome: Registration writes one row per shopper.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!