SQL Terminology Flashcards

(39 cards)

1
Q

What is a Database?

A

A structured set of data held in a computer.

Example: A company’s HR system uses a database to store employee data.

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

What is a Table in SQL?

A

A collection of related data entries, organized in rows and columns.

Example: ‘Employees’ table with columns like id, name, department.

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

What is a Row (Record)?

A

A single data item in a table.

Example: One employee’s data in the Employees table.

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

What is a Column (Field)?

A

A single data attribute within a table.

Example: The ‘salary’ column in the Employees table.

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

What is a Primary Key?

A

A column (or set of columns) that uniquely identifies each row in a table.

Example: ‘id’ column in Employees is a primary key.

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

What is a Foreign Key?

A

A column that creates a relationship between two tables.

Example: ‘dept_id’ in Employees referencing ‘id’ in Departments.

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

What is a Query?

A

A request for data or information from a database.

Example: SELECT * FROM Employees;

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

What does SQL stand for?

A

Structured Query Language.

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

What does CRUD stand for?

A

Create, Read, Update, Delete.

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

What is a JOIN used for?

A

To combine rows from two or more tables based on a related column.

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

What is an Index?

A

A performance optimization feature that speeds up retrieval operations.

Example: CREATE INDEX idx_name ON Employees(name);

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

What is a NULL value?

A

A special marker indicating that a data value does not exist.

Example: A missing phone number in a contact table.

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

What is a Constraint?

A

A rule enforced on data columns (e.g., NOT NULL, UNIQUE).

Example: NOT NULL on ‘name’ column to prevent empty names.

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

What is a Schema?

A

The structure that defines the organization of data (tables, columns, types, etc.).

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

What is a View in SQL?

A

A virtual table based on the result-set of an SQL query.

Example: A view showing only active employees.

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

What is a Subquery?

A

A query nested inside another query.

17
Q

What are Aggregate Functions?

A

Functions that perform calculations on multiple rows (e.g., COUNT, SUM).

18
Q

What is Normalization?

A

The process of organizing data to reduce redundancy.

19
Q

What is a Transaction?

A

A sequence of operations performed as a single logical unit of work.

20
Q

What are the ACID properties?

A

Atomicity, Consistency, Isolation, Durability – guarantees for database transactions.

21
Q

What is the purpose of the SELECT statement?

A

Retrieves data from a database.

22
Q

Fill in the blank: The SQL command to select all columns from a table is ______.

A

SELECT * FROM table_name

23
Q

What does the WHERE clause do in a SQL query?

A

Filters records based on specified conditions.

24
Q

What is the result of using ORDER BY in a SQL query?

A

Sorts the result set based on specified columns.

25
What does GROUP BY do?
Groups rows that have the same values in specified columns into summary rows.
26
What is the purpose of the HAVING clause?
Filters records after grouping.
27
What is an INNER JOIN?
Combines rows from two tables where there is a match in both tables.
28
What is a LEFT JOIN?
Returns all rows from the left table and matched rows from the right table.
29
What is a RIGHT JOIN?
Returns all rows from the right table and matched rows from the left table.
30
What is a FULL OUTER JOIN?
Returns all records when there is a match in either left or right table.
31
What is the syntax for inserting data into a table?
INSERT INTO table_name (columns) VALUES (values).
32
What is the syntax for updating data in a table?
UPDATE table_name SET column1 = value1 WHERE condition.
33
What is the syntax for deleting data from a table?
DELETE FROM table_name WHERE condition.
34
What is the SQL command to create a new table?
CREATE TABLE table_name (columns and types).
35
What is the purpose of the ALTER TABLE command?
Modifies an existing table structure.
36
What does the DROP TABLE command do?
Deletes a table and its data from the database.
37
What is a best practice regarding SELECT statements?
Avoid SELECT * in production queries.
38
What is a best practice regarding table and column names?
Use meaningful names.
39
Fill in the blank: Regular practice using platforms like ______ can help improve SQL skills.
LeetCode, HackerRank, Mode Analytics