Podcast
Questions and Answers
What role does a primary key serve in a relational database table?
What role does a primary key serve in a relational database table?
- To store large volumes of data
- To allow for duplicate entries
- To ensure each entry is distinct (correct)
- To link tables through relationships
Which relationship type is characterized by one row in a first table being associated with many rows in a second table?
Which relationship type is characterized by one row in a first table being associated with many rows in a second table?
- Many to Many Relationship
- Self-Referencing Relationship
- One to One Relationship
- One to Many Relationship (correct)
What is the purpose of a foreign key in a relational database?
What is the purpose of a foreign key in a relational database?
- It establishes a relationship between two tables (correct)
- It defines the primary key in a table
- It categorizes data types for entries
- It serves as an identifier for records within the same table
Which of the following must be true for a primary key?
Which of the following must be true for a primary key?
What notation indicates a one-to-many relationship in a schema diagram?
What notation indicates a one-to-many relationship in a schema diagram?
How is a many-to-many relationship typically established in a relational database?
How is a many-to-many relationship typically established in a relational database?
Which of the following is an example of enforcing referential integrity?
Which of the following is an example of enforcing referential integrity?
What does the Crow’s Foot notation represent in database relationships?
What does the Crow’s Foot notation represent in database relationships?
When creating a table in a database, which constraint ensures that a column cannot contain NULL values?
When creating a table in a database, which constraint ensures that a column cannot contain NULL values?
In modifying a database, which command is used to change existing values in a table?
In modifying a database, which command is used to change existing values in a table?
Which of these SQL commands is used to remove a table from a database?
Which of these SQL commands is used to remove a table from a database?
What is a composite primary key?
What is a composite primary key?
Which SQL command is used to insert new data into a table?
Which SQL command is used to insert new data into a table?
When defining a foreign key in SQL, how is it typically represented?
When defining a foreign key in SQL, how is it typically represented?
What happens to the child records when the ON DELETE CASCADE option is used?
What happens to the child records when the ON DELETE CASCADE option is used?
Which data type has the best precision for storing decimal numbers?
Which data type has the best precision for storing decimal numbers?
What is the format for storing dates in SQL?
What is the format for storing dates in SQL?
What does ROLLBACK do in a transaction?
What does ROLLBACK do in a transaction?
Which of the following is NOT an ACID property?
Which of the following is NOT an ACID property?
What is the primary advantage of using a distributed database?
What is the primary advantage of using a distributed database?
How does the SET TRANSACTION ISOLATION LEVEL command affect SQL transactions?
How does the SET TRANSACTION ISOLATION LEVEL command affect SQL transactions?
Which SQL command allows data to be populated from one table into another?
Which SQL command allows data to be populated from one table into another?
Which statement about text data types is accurate?
Which statement about text data types is accurate?
What isolation level allows a transaction to see uncommitted changes from other transactions?
What isolation level allows a transaction to see uncommitted changes from other transactions?
If a user wanted to delete a record from a parent table, what constraint must be checked?
If a user wanted to delete a record from a parent table, what constraint must be checked?
What is the primary function of a Transactional Control Language?
What is the primary function of a Transactional Control Language?
To what does fragmentation in a distributed database refer?
To what does fragmentation in a distributed database refer?
What is a significant disadvantage of storage fragmentation?
What is a significant disadvantage of storage fragmentation?
Which RAID level offers redundancy by mirroring the original data?
Which RAID level offers redundancy by mirroring the original data?
What is a key advantage of storage replication?
What is a key advantage of storage replication?
In the context of distributed databases, which of the following is part of the CAP theorem?
In the context of distributed databases, which of the following is part of the CAP theorem?
Which feature of RAID Level 5 enhances data safety?
Which feature of RAID Level 5 enhances data safety?
What is a common issue associated with performing updates in storage replication?
What is a common issue associated with performing updates in storage replication?
How does sharding improve database performance?
How does sharding improve database performance?
What happens if one drive fails in a RAID Level 0 configuration?
What happens if one drive fails in a RAID Level 0 configuration?
What does the '$gte' operator signify in PyMongo queries?
What does the '$gte' operator signify in PyMongo queries?
Which RAID configuration distributes parity data to enhance reliability?
Which RAID configuration distributes parity data to enhance reliability?
What is one of the main advantages of using RAID in distributed databases?
What is one of the main advantages of using RAID in distributed databases?
When using the find() method in PyMongo, what does it return?
When using the find() method in PyMongo, what does it return?
What is a potential consequence of using storage fragmentation?
What is a potential consequence of using storage fragmentation?
What best describes the role of collections in MongoDB?
What best describes the role of collections in MongoDB?
Flashcards
Relational Database
Relational Database
A structured data set organized into tables with relationships between them.
Primary Key
Primary Key
A unique identifier for each row in a table.
Foreign Key
Foreign Key
A column in one table referencing a primary key in another.
One-to-Many Relationship
One-to-Many Relationship
Signup and view all the flashcards
Many-to-Many Relationship
Many-to-Many Relationship
Signup and view all the flashcards
One-to-One Relationship
One-to-One Relationship
Signup and view all the flashcards
Entity Integrity
Entity Integrity
Signup and view all the flashcards
Referential Integrity
Referential Integrity
Signup and view all the flashcards
Atomicity
Atomicity
Signup and view all the flashcards
update statement
update statement
Signup and view all the flashcards
delete statement
delete statement
Signup and view all the flashcards
Composite Primary Key
Composite Primary Key
Signup and view all the flashcards
Schema Diagram
Schema Diagram
Signup and view all the flashcards
Linking Table
Linking Table
Signup and view all the flashcards
Cardinality
Cardinality
Signup and view all the flashcards
ON DELETE CASCADE
ON DELETE CASCADE
Signup and view all the flashcards
ON DELETE SET NULL
ON DELETE SET NULL
Signup and view all the flashcards
Data Types
Data Types
Signup and view all the flashcards
Integer Types
Integer Types
Signup and view all the flashcards
FLOAT
FLOAT
Signup and view all the flashcards
DOUBLE
DOUBLE
Signup and view all the flashcards
ASCII
ASCII
Signup and view all the flashcards
UTF-8
UTF-8
Signup and view all the flashcards
SQL Text Types
SQL Text Types
Signup and view all the flashcards
SQL Datetime
SQL Datetime
Signup and view all the flashcards
SQL Transactions
SQL Transactions
Signup and view all the flashcards
BEGIN TRANSACTION
BEGIN TRANSACTION
Signup and view all the flashcards
COMMIT
COMMIT
Signup and view all the flashcards
ROLLBACK
ROLLBACK
Signup and view all the flashcards
Distributed Database
Distributed Database
Signup and view all the flashcards
Distributed Storage
Distributed Storage
Signup and view all the flashcards
Storage Fragmentation
Storage Fragmentation
Signup and view all the flashcards
Sharding
Sharding
Signup and view all the flashcards
Arrays (in sharding)
Arrays (in sharding)
Signup and view all the flashcards
Storage Replication
Storage Replication
Signup and view all the flashcards
RAID
RAID
Signup and view all the flashcards
RAID Level 0
RAID Level 0
Signup and view all the flashcards
RAID Level 1
RAID Level 1
Signup and view all the flashcards
RAID Level 5
RAID Level 5
Signup and view all the flashcards
CAP Theorem
CAP Theorem
Signup and view all the flashcards
MongoDB
MongoDB
Signup and view all the flashcards
Collections (MongoDB)
Collections (MongoDB)
Signup and view all the flashcards
Documents (MongoDB)
Documents (MongoDB)
Signup and view all the flashcards
Pymongo
Pymongo
Signup and view all the flashcards
Querying (MongoDB)
Querying (MongoDB)
Signup and view all the flashcards
Study Notes
Relational Database Design Principles
- Relational databases structure data in interconnected tables.
- Key components include tables, rows, columns, relationships, primary keys, and foreign keys.
- Primary keys uniquely identify records in a table.
- These keys are unique, non-null (not empty), immutable (unchanging), and minimal.
- Primary keys can be single columns or composite (multiple columns).
- Foreign keys link tables by referencing primary keys in other tables.
- Relationships between tables can be one-to-many, many-to-many, or one-to-one.
- One-to-many: One record in one table can be related to many records in another.
- Many-to-many: One record in one table can be related to many in another, vice versa.
- One-to-one: One record in each table is related to only one in the other.
Schema Diagram Notation
- 1 represents "one" and ∞ represents "many" in relationships.
- Arrow notation connects many to one side.
- Crow's foot notation similarly indicates many side.
Building a Relational Database
- Identify needed tables with defined columns, data types, and primary/foreign keys.
- Determine relationships between tables.
Database Design Decisions
- Avoid incomplete representation and unnecessary redundancy.
- Store information in smallest logical units (atomicity).
- Primary keys should be unique and non-null for each table.
- Foreign keys should be valid references to primary keys.
Representing Relationships
- One-to-many relationships involve linking a table with foreign keys to another table's primary key.
- Many-to-many relationships use a linking table to connect the related tables.
- One-to-one relationships use the same primary key in both related tables.
Data Types
- Integers: Vary in size from TINYINT to BIGINT, indicating storage capacity.
- Decimals/Floats: Use floating-point representation for approximate decimal values.
- Text: Employ character encodings like ASCII, UTF-8, for various text types.
- Crucial to choose the most appropriate data types based on intended data.
Modifying Databases
UPDATE
changes existing values.DELETE
removes rows.DELETE
syntax with conditions for foreign-key constraints to preclude data loss.ON DELETE CASCADE
automatically deletes related rows in child tables when a parent row is deletedON DELETE SET NULL
sets foreign keys referenced to NULL in child tables
SQL Transactions
- Transactions ensure data accuracy by treating related operations as a single unit.
- Atomicity: All operations succeed or none do.
- Consistency: Data remains valid throughout a transaction.
- Isolation: Transactions do not interfere with each other.
- Durability: Data changes survive transaction.
- Transaction commands:
BEGIN TRANSACTION
,COMMIT
,ROLLBACK
.
Distributed Databases
- Databases are replicated or spread across multiple computers for enhanced functionality.
- Distributed database models include sharding and replication.
- Scalability, performance, and resilience benefits. -Data can be larger. -Data distributed to multiple sites.
- Properties of distributed databases: fragmentation, replication, resilience, and fault tolerance.
Storage Replication
- Redundant data backups enhance data availability in case of failures.
- Advantages include data availability, parallelism, reduced data transfer.
- Disadvantages include increased cost of updates, and complex concurrency control.
Redundant Array of Independent Disks (RAID)
- RAID levels provide data redundancy, and performance improvements.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Explore the key principles of relational database design, focusing on the structure of data in interconnected tables. Learn about primary keys, foreign keys, and various types of relationships between tables. This quiz will test your knowledge of schema diagrams and notation used in relational databases.