relational database quizzes

pull/121/head
Jen Looper 4 years ago
parent 3207df85f4
commit 4ef3fe4503

@ -20,7 +20,7 @@ Let's begin our exploration by starting a table to store information about citie
| Atlanta | United States |
| Auckland | New Zealand |
Notice the column names of **city**, **country** and **population** to describe the data being stored, and each row has information about once city.
Notice the column names of **city**, **country** and **population** describe the data being stored, and each row has information about one city.
## The shortcomings of a single table approach
@ -58,7 +58,7 @@ Let's return to our data and determine how we want to split things up. We know w
But before we create the next table, we need to figure out how to reference each city. We need some form of an identifier, ID or (in technical database terms) a primary key. A primary key is a value used to identify one specific row in a table. While this could be based on a value itself (we could use the name of the city, for example), it should almost always be a number or other identifier. We don't want the id to ever change as it would break the relationship. You will find in most cases the primary key or id will be an auto-generated number.
> [!NOTE] Foreign key is frequently abbreviated as PK
> ✅ Primary key is frequently abbreviated as PK
### cities
@ -68,7 +68,7 @@ But before we create the next table, we need to figure out how to reference each
| 2 | Atlanta | United States |
| 3 | Auckland | New Zealand |
> [NOTE] You will notice we use the terms "id" and "primary key" interchangeably during this lesson. The concepts here apply to DataFrames, which you will explore later. DataFrames don't use the terminology of "primary key", however you will notice they behave much in the same way.
> You will notice we use the terms "id" and "primary key" interchangeably during this lesson. The concepts here apply to DataFrames, which you will explore later. DataFrames don't use the terminology of "primary key", however you will notice they behave much in the same way.
With our cities table created, let's store the rainfall. Rather than duplicating the full information about the city, we can use the id. We should also ensure the newly created table has an *id* column as well, as all tables should have an id or primary key.

@ -9,7 +9,7 @@
"title": "Relational Databases - Pre Quiz",
"quiz": [
{
"questionText": "quiz 2 question 2",
"questionText": "A database can be considered a table with columns and rows",
"answerOptions": [
{
"answerText": "True",
@ -22,36 +22,36 @@
]
},
{
"questionText": "q2",
"questionText": "Most databases are comprised of",
"answerOptions": [
{
"answerText": "classical ML was invented first",
"answerText": "one table",
"isCorrect": "false"
},
{
"answerText": "the use of neural networks",
"isCorrect": "true"
"answerText": "one spreadsheet",
"isCorrect": "false"
},
{
"answerText": "deep learning is used in robots",
"isCorrect": "false"
"answerText": "many tables",
"isCorrect": "true"
}
]
},
{
"questionText": "q3",
"questionText": "You can avoid duplicating column names by",
"answerOptions": [
{
"answerText": "to automate the solving of multi-dimensional problems",
"answerText": "creating many tables",
"isCorrect": "false"
},
{
"answerText": "to customize a shopping experience based on the type of customer",
"isCorrect": "false"
"answerText": "creating tables with relationships built in",
"isCorrect": "true"
},
{
"answerText": "both of the above",
"isCorrect": "true"
"answerText": "sticking to one big table",
"isCorrect": "false"
}
]
}
@ -62,49 +62,49 @@
"title": "Relational Databases - Post Quiz",
"quiz": [
{
"questionText": "quiz 2 question 2",
"questionText": "A primary key is",
"answerOptions": [
{
"answerText": "True",
"answerText": "a value used to identify one specific row in a table",
"isCorrect": "true"
},
{
"answerText": "False",
"answerText": "a value used to make values unique",
"isCorrect": "false"
},
{
"answerText": "a value used to force capitalization",
"isCorrect": "false"
}
]
},
{
"questionText": "q2",
"questionText": "A numeric 'ID' column would be a good primary key",
"answerOptions": [
{
"answerText": "classical ML was invented first",
"isCorrect": "false"
},
{
"answerText": "the use of neural networks",
"answerText": "true",
"isCorrect": "true"
},
{
"answerText": "deep learning is used in robots",
"answerText": "false",
"isCorrect": "false"
}
]
},
{
"questionText": "q3",
"questionText": "A foreign key is used to",
"answerOptions": [
{
"answerText": "to automate the solving of multi-dimensional problems",
"isCorrect": "false"
"answerText": "values that reference the ids in a separate table",
"isCorrect": "true"
},
{
"answerText": "to customize a shopping experience based on the type of customer",
"answerText": "values that reference the strings in a separate table",
"isCorrect": "false"
},
{
"answerText": "both of the above",
"isCorrect": "true"
"answerText": "preserve values that change over time",
"isCorrect": "false"
}
]
}
@ -160,7 +160,7 @@
"isCorrect": "false"
}
]
}
}
]
},
{
@ -177,7 +177,7 @@
{
"answerText": "Key-value",
"isCorrect": "false"
},
},
{
"answerText": "Columnar",
"isCorrect": "false"

Loading…
Cancel
Save