Tutorials SQL Server Tutorial

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 basicsQueriesAdvanced

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

  1. Run the script in your database.
  2. Expand Tables in Object Explorer and refresh.
  3. Insert a second customer with a different email.
  4. Add Phone NVARCHAR(20) NULL and insert with a phone.
  5. 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.

Mid PDF Detailed
INNER JOIN: Returns only the rows with matching values in both tables.?
Short answer: Use case: When you only want matching records. Say this in the interview Define — one clear sentence (the short answer above). Example — relate it to a project like ShopNest or your real work. Trade-off — w…
Mid PDF Detailed
Large Tables: Indexes are especially helpful for large tables that are queried?
Short answer: Large Tables: Indexes are especially helpful for large tables that are queried? is a common interview topic in SQL & Databases. Give a clear definition, then one concrete example. Real-world example (Sh…
Mid PDF Detailed
Important tables:?
Short answer: Customers: Contains customer details (name, address, etc.). Orders: Contains order details and references customers. Order_Items: A join table between Orders and Products. Products: Product details (name, d…
Mid PDF Detailed
FULL OUTER JOIN: Returns all rows from both tables, with matching rows where?
Short answer: available. If there’s no match, NULL is returned for the missing side. Use case: When you want all records from both tables. Say this in the interview Define — one clear sentence (the short answer above). E…
Mid PDF Detailed
Use Lookup Tables: For categories or repeated groups of data, use lookup tables?
Short answer: with primary keys and referential integrity rather than repeating the data. Real-world example (ShopNest) ShopNest’s SQL Server database stores customers, products, and orders. Good indexes and clear foreig…
Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

SQL Server Tutorial
Course syllabus

SQL Server Tutorial

SQL — Foundations
SQL — SQL Queries & Clauses
SQL — Joins & Relationships
SQL — Indexing & Performance
SQL — Stored Procedures & Functions
SQL — Transactions & Concurrency
SQL — Advanced SQL Server
SQL — Security & High Availability
SQL — 2022 & Cloud
SQL — Real-World Projects
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details