SQL Flashcards
What is the purpose of database normalization and how does it work?
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.
Explain the difference between an inner join and outer join using an
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.
What is an inner join?
gets all records that are common between both tables based on the foreign key
What is a left join?
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
What is a right join?
is like the above but gets all records in the RIGHT table
What is a full join?
gets all records from both tables and puts NULL in the columns where related records do not exist in the opposite table