2. Talking to a Database
Idea: A database server holds many databases. A database holds tables. Tables hold rows. Rows have columns.
Server
The server is a program waiting for your T-SQL commands.
Database
A named container (like a folder) that groups related tables.
Table
A grid of rows and columns. Each column has a data type. Each row is one record (like one customer).
How You Talk
You write a T-SQL statement and send it via a tool (SSMS, Azure Data Studio, command line). Server parses it, runs it, returns results.
Placeholders for Examples
Coming soon: creating a tiny sample table.
Advanced Deep Dive ADVANCED
Schemas: Databases organize objects into schemas (like folders). Use schemas (e.g., sales.Orders) for security boundaries and clarity.
Metadata: System catalog views (sys.tables, sys.columns) let you introspect structure, enabling dynamic scripts.
Data Types Nuance: Picking correct types (e.g., DECIMAL vs FLOAT) affects precision and storage. Character types (VARCHAR/NVARCHAR) impact collation and international text.
Collation: Controls sort and compare rules for text. Mixing collations can require explicit COLLATE clauses.
Locking Basics: Even a basic read can take shared locks; writes take exclusive locks. Understanding isolation levels prevents blocking issues.