SQL Flashcards

1
Q

What is referential integrity?

A

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.

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

What are the ACID principles?

A

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.

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

What is the difference between primary keys and foreign keys?

A

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.

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

What is a dataSource?

A

A datasource is the initial location where data is created.

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

What is a Left JOIN, Right JOIN, JOIN?

A

(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

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