Databases / SQL Flashcards

1
Q

What is the SQL Command for Selecting / Querying Data?

A

SELECT Email
FROM Customer
WHERE CustomerID = 1;

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

What is the SQL command for inserting data?

A

INSERT INTO Customer (FirstName, LastName, Email)

VALUES (“John”, “Smith”, “JSmith@gmail.com”);

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

What is the SQL command for deleting data?

A

DELETE FROM Customer

WHERE CustomerID = 1;

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

What is the SQL Command for updating existing data?

A

UPDATE Customer SET Email (JSmith@gmail.com)

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

What is the SQL Command for creating a table?

A
CREATE TABLE Customer
(
     CustomerID int,
     LastName varchar,
     FirstName varchar,
     Email varchar
);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Primary Key in a Database?

A

It is a unique identifier that is unique to a certain piece of data so it can be used in queries or used to link to other tables so data isn’t repeated in the database.

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

What is a Foreign Key in a Database?

A

It is a reference to a primary key within another table so that that particular table can link to the data of another table.

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

What is an ERD?

A

it is an Entity Relationship Diagram and is a visual representation of the relationships between the tables with the use of primary and foreign keys.

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

What is UNF?

A

Where there is no Normalisation done on the database

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

What is 1NF?

A

This is where, repeating data in rows (records) and columns is removed, data is made atomic and each row is assigned a unique identifier and each field has a unique name.

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

What is 2NF?

A

This is where redundant data is removed, as it may not rely on other factors within the database, as a result It won’t be necessary.

If data is still important but doesn’t directly relate to the current table it can be turned into another table that links to the older one.

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

What is 3NF?

A

This is further analysis of redundant data that could be removed from the database, some examples can be having a field that details the city and another that details the country. There is no need for the country field as you can figure it out with common knowledge of the city.

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

What does ACID stand for?

A

Atomicity
Consistency
Isolation
Durability

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

What is Atomicity in ACID?

A

All or Nothing, where the transaction has been completed in full or not at all.

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

What is Consistency in ACID?

A

This is where can transaction always returns a consistent state without any issues. All rules are intact after the transaction.

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

What is Isolation in ACID?

A

This is where transactions occur on their own and cannot be influenced by other transactions being undertaken. The result should be the same if five people completed the same transaction at the same time.

17
Q

What is Durability in ACID?

A

This means that when the transaction has been completed the results are preeminently stored immediately, so if there is a power failure the transaction won’t be effected..