SECTION 7: Databases Flashcards

(29 cards)

1
Q

What is a database?

A

A structured collection of data that can be easily accessed, managed, and updated.

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

What is a flat-file database?

A

A database that stores all data in a single table.

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

What is a relational database?

A

A database with multiple tables linked by relationships.

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

What is a table (in databases)?

A

A set of records organised in rows and columns.

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

What is a field?

A

A single piece of data (column) in a record.

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

What is a record?

A

A collection of related fields (row).

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

What is a primary key?

A

A field that uniquely identifies each record in a table.

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

What is a foreign key?

A

A field in one table that links to the primary key in another table.

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

What is data redundancy?

A

Unnecessary repetition of data.

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

How do relational databases reduce redundancy?

A

By storing related data in separate linked tables.

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

What is SQL?

A

Structured Query Language – used to create, manage, and query databases.

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

What does the SELECT statement do?

A

Retrieves data from a database.

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

What does the FROM clause do?

A

Specifies which table to query.

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

What does the WHERE clause do?

A

Filters records based on conditions.

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

What does the AND operator do in SQL?

A

Returns records where both conditions are true.

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

What does the OR operator do in SQL?

A

Returns records where at least one condition is true.

17
Q

What does the * symbol mean in SQL?

A

Selects all fields.

18
Q

Write a sample SQL query to get names of students aged 15.

A

SELECT name FROM students WHERE age = 15;

19
Q

Write an SQL query to select name and age from table “people” where city is “London”.

A

SELECT name, age FROM people WHERE city = ‘London’;

20
Q

What is a data type in a database?

A

A classification that specifies the kind of data a field can hold, such as INTEGER, TEXT, DATE, etc.

21
Q

Why are data types important in databases?

A

ensure data is stored consistently and help prevent errors by restricting the type of data entered.

22
Q

What does the ORDER BY clause do in SQL?

A

It sorts the result set of a query by one or more columns.

23
Q

What is the difference between ASC and DESC in SQL?

A

ASC sorts the data in ascending order (default), while DESC sorts it in descending order.

24
Q

What does the INSERT INTO command do in SQL?

A

It adds new records to a table.

25
What does the UPDATE command do in SQL?
It modifies existing records in a table.
26
What does the DELETE FROM command do in SQL?
It removes records from a table.
27
What is data redundancy?
The unnecessary repetition of data within a database.
28
What is data inconsistency?
When the same data exists in multiple places but is not the same, leading to errors.
29
How do relational databases reduce redundancy and inconsistency?
organizing data into related tables and using keys to link them, ensuring each piece of data is stored only once.