SQL Flashcards

1
Q

What is the purpose of database normalization and how does it work?

A

The primary purpose of normalization is to make databases more efficient by eliminating redundant data and ensuring data dependencies are coherent. Storing data logically and efficiently reduces the amount of space the database takes up and improves performance. The set of guidelines used to achieve normalization are called normal forms, numbered from 1NF to 5NF. A form can be thought of as a best-practice format for laying out data within a database.

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

Explain the difference between an inner join and outer join using an

A

An inner join is when you combine rows from two tables and create a result set based on the predicate, or joining condition. The inner join only returns rows when it finds a match in both tables. An outer join will also return unmatched rows from one table if it is a single outer join, or both tables if it is a full outer join. A solid example of this will clearly illustrate the difference and demonstrate how well the developer understands joins.

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

What is an inner join?

A

gets all records that are common between both tables based on the foreign key

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

What is a left join?

A

gets all records from the LEFT linked table but if you have selected some columns from the RIGHT table, if there is no related records, these columns will contain NULL

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

What is a right join?

A

is like the above but gets all records in the RIGHT table

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

What is a full join?

A

gets all records from both tables and puts NULL in the columns where related records do not exist in the opposite table

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