What is SQL?
A language used to communicate with databases — retrieve, update, create, and delete data.
SQL stands for Structured Query Language.
Why is SQL called a “universal translator”?
Because almost all database systems use SQL to manage data.
This highlights SQL’s widespread applicability across different database platforms.
What does SQL let you do?
These are fundamental operations performed using SQL.
Why does learning SQL matter?
It gives you the “secret code” to control and manage data.
Mastery of SQL is crucial for data management and analysis.
What platform does this module use?
Microsoft SQL Server
SQL Server is a relational database management system developed by Microsoft.
What analogy describes SQL Server?
The kitchen where all database “meals” are prepared.
This analogy illustrates the role of SQL Server in data management.
How much SQL transfers across other systems?
~90% works the same across Oracle, MySQL, PostgreSQL.
This indicates the high compatibility of SQL across different database systems.
What changes between database systems?
Small syntax differences (dialects), but core logic stays the same.
Understanding these differences is key for database migration.
What is the .mdf file?
Primary data file storing tables, views; the main database storage.
MDF stands for Master Database File.
What is the .ndf file?
Secondary data file used for overflow storage.
NDF stands for Secondary Database File.
What is the .ldf file?
Transaction log file storing every change before it happens.
LDF stands for Log Database File.
Why are transaction logs important?
They allow crash recovery and prevent data loss.
Transaction logs are essential for maintaining data integrity.
What happens when you insert a new record?
Data goes to .mdf/.ndf and a log entry goes to .ldf.
This process ensures data is stored and logged simultaneously.
What happens when a log file gets full?
It is archived and a new log file starts.
This mechanism prevents data loss and maintains logging continuity.
What do logs help maintain?
Data integrity and durability.
Logs are crucial for ensuring that data remains consistent and recoverable.
What is an index in a database?
A structure that speeds up searches by avoiding full table scans.
Indexes enhance query performance significantly.
What is the book analogy for indexing?
It works like a book’s table of contents.
This analogy helps understand how indexes organize data for quick access.
Why are indexes important?
They improve performance, especially with millions of rows.
Indexes are vital for efficient data retrieval.
What does NOT NULL enforce?
A value must always be provided — no empty fields.
This constraint ensures data completeness.
What does UNIQUE enforce?
No duplicate values allowed in the column.
This constraint maintains data integrity by preventing duplicates.
What does a FOREIGN KEY enforce?
Valid relationships between tables (referential integrity).
Foreign keys are essential for maintaining relational database structure.
What is a table?
A collection of records (rows) and attributes (columns).
Tables are fundamental components of a relational database.
What are rows?
Individual records in a table.
Each row represents a unique entry in the table.
What are columns?
Attributes describing a record.
Columns define the data structure of a table.