Relational & NoSQL Database Design Flashcards
7 cards from real CCP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Relational & NoSQL Database Design flashcards as text
What is a composite key in relational database design?
Answer: A primary key made up of two or more attributes
A composite key uses two or more attributes together to uniquely identify a row in a table when no single attribute alone can serve as a unique identifier.
Which SQL command is used to permanently remove a table and all its data from the database?
Answer: DROP TABLE
DROP TABLE removes the table definition and all its data permanently, while DELETE removes rows and TRUNCATE removes all rows but keeps the table structure.
In the BASE model used by many NoSQL systems, what does 'Eventually Consistent' mean?
Answer: Data may be temporarily inconsistent but will converge to a consistent state over time
Eventual consistency means that given enough time without new updates, all replicas will converge to the same value, accepting temporary inconsistency for availability.
Which type of relationship in ER modeling requires a junction (bridge) table for implementation in a relational database?
Answer: Many-to-many relationship
Many-to-many relationships cannot be directly represented in relational tables and require a junction table containing foreign keys from both related entities.
Which Redis data structure is most appropriate for implementing a leaderboard with ranked scores?
Answer: Sorted Set
Redis Sorted Sets store members with associated floating-point scores and automatically maintain ranking order, making them ideal for leaderboards.
What is a materialized view in a relational database?
Answer: A precomputed query result stored as a physical table
A materialized view stores the result of a query physically on disk, improving read performance for expensive queries at the cost of storage and refresh overhead.
In relational algebra, which operation combines two relations by returning only tuples that appear in both?
Answer: Intersection
The intersection operation returns only the tuples that are common to both input relations, which must have the same schema.