Intro to SQL Flashcards

(30 cards)

1
Q

What is SQL?

A

A language used to communicate with databases — retrieve, update, create, and delete data.

SQL stands for Structured Query Language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is SQL called a “universal translator”?

A

Because almost all database systems use SQL to manage data.

This highlights SQL’s widespread applicability across different database platforms.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What does SQL let you do?

A
  • Query data
  • Update records
  • Create tables
  • Delete tables

These are fundamental operations performed using SQL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Why does learning SQL matter?

A

It gives you the “secret code” to control and manage data.

Mastery of SQL is crucial for data management and analysis.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What platform does this module use?

A

Microsoft SQL Server

SQL Server is a relational database management system developed by Microsoft.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What analogy describes SQL Server?

A

The kitchen where all database “meals” are prepared.

This analogy illustrates the role of SQL Server in data management.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How much SQL transfers across other systems?

A

~90% works the same across Oracle, MySQL, PostgreSQL.

This indicates the high compatibility of SQL across different database systems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What changes between database systems?

A

Small syntax differences (dialects), but core logic stays the same.

Understanding these differences is key for database migration.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the .mdf file?

A

Primary data file storing tables, views; the main database storage.

MDF stands for Master Database File.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the .ndf file?

A

Secondary data file used for overflow storage.

NDF stands for Secondary Database File.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the .ldf file?

A

Transaction log file storing every change before it happens.

LDF stands for Log Database File.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why are transaction logs important?

A

They allow crash recovery and prevent data loss.

Transaction logs are essential for maintaining data integrity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What happens when you insert a new record?

A

Data goes to .mdf/.ndf and a log entry goes to .ldf.

This process ensures data is stored and logged simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What happens when a log file gets full?

A

It is archived and a new log file starts.

This mechanism prevents data loss and maintains logging continuity.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What do logs help maintain?

A

Data integrity and durability.

Logs are crucial for ensuring that data remains consistent and recoverable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is an index in a database?

A

A structure that speeds up searches by avoiding full table scans.

Indexes enhance query performance significantly.

17
Q

What is the book analogy for indexing?

A

It works like a book’s table of contents.

This analogy helps understand how indexes organize data for quick access.

18
Q

Why are indexes important?

A

They improve performance, especially with millions of rows.

Indexes are vital for efficient data retrieval.

19
Q

What does NOT NULL enforce?

A

A value must always be provided — no empty fields.

This constraint ensures data completeness.

20
Q

What does UNIQUE enforce?

A

No duplicate values allowed in the column.

This constraint maintains data integrity by preventing duplicates.

21
Q

What does a FOREIGN KEY enforce?

A

Valid relationships between tables (referential integrity).

Foreign keys are essential for maintaining relational database structure.

22
Q

What is a table?

A

A collection of records (rows) and attributes (columns).

Tables are fundamental components of a relational database.

23
Q

What are rows?

A

Individual records in a table.

Each row represents a unique entry in the table.

24
Q

What are columns?

A

Attributes describing a record.

Columns define the data structure of a table.

25
What is a **primary key**?
Unique identifier for each record; cannot be NULL. ## Footnote Primary keys ensure that each record is distinct.
26
Why are **primary keys important**?
Guarantee each row can be found precisely and prevent duplicates. ## Footnote They are crucial for data retrieval and integrity.
27
What is a **foreign key**?
A link referencing a primary key in another table. ## Footnote Foreign keys establish relationships between different tables.
28
What does a **data type** do?
Defines what kind of data a column can store. ## Footnote Data types are essential for data validation.
29
Give examples of **data types**.
* INT (whole numbers) * VARCHAR (text) * DATE (date values) ## Footnote These are common data types used in SQL databases.
30
What’s the analogy for **data types**?
Labeling containers in a kitchen (flour, sugar, salt). ## Footnote This analogy illustrates how data types categorize data.