SQL Flashcards
What is referential integrity?
A foreign key must have a matching primary key in a database. This is important because it makes sure that the two tables are in sync when certain actions are performed and prevents errors from being introduced in the table.
ex. If you have a table called Order(has a customerID as a foreign key),
must have a matching primary key on another table in the database. So the Customer table should have a primary customerID.
What are the ACID principles?
ACID refers to the key four properties of a transaction: Atomicity, Consistency, Isolation, and Durability.
Atomicity - all changes to a data is performed in a single operation.
Consistency - data is always in a consistent state
Isolation- the intermediate state of a transaction is invisible to other transactions.
Durability - once a transaction is complete the changes can never be undone.
What is the difference between primary keys and foreign keys?
A primary key is a key that uniquely identifies every row in that table. A foreign key is a key that creates a relationship between two tables. They are used to maintain referential integrity.
What is a dataSource?
A datasource is the initial location where data is created.
What is a Left JOIN, Right JOIN, JOIN?
(INNER) JOIN: Returns records that have matching values in both tables
LEFT (OUTER) JOIN: Returns all records from the left table, and the matched records from the right table
RIGHT (OUTER) JOIN: Returns all records from the right table, and the matched records from the left table
FULL (OUTER) JOIN: Returns all records when there is a match in either left or right table