Advanced Database Concepts Review
Welcome to the Advanced Database Concepts Review course. This module is designed for computer‑science students and professionals who want to deepen their understanding of relational database…

In SQL Server, which data type should be used to store Unicode strings such as Vietnamese characters?
When mapping a weak entity to a relational schema, which of the following correctly forms its primary key?
Which SQL clause is evaluated immediately after the GROUP BY clause during query execution?
In a many‑to‑many relationship, what additional table is required when converting to relational form?
Which referential action will set the foreign key column to NULL when the referenced primary key is deleted?
What is the effect of the SQL clause 'SELECT DISTINCT' on the result set?
Which of the following best describes a total participation constraint in an ER diagram?
When defining a CHECK constraint on a numeric column, which of the following expressions correctly enforces non‑negative values?
Which SQL Server keyword is used to limit the number of rows returned without using the ANSI LIMIT clause?
In a relational schema, which key type is defined as a minimal superkey that uniquely identifies a tuple?
Which join type returns all rows from the left table and matching rows from the right table, inserting NULLs for non‑matching right rows?
What is the purpose of the SQL keyword 'EXISTS' when used with a subquery?
Which constraint ensures that a column cannot contain duplicate values but may still allow NULLs?
When creating a table with a composite primary key, which of the following statements is true?
Which of the following best explains the difference between a strong entity and a weak entity in ER modeling?
In SQL Server, which clause is used to define a default value for a column at table creation?
Which of the following statements about the 'UNION' operator is correct?
What is the main purpose of a 'TRIGGER' in a DBMS, even though it is not explicitly listed in the excerpt?
When using the 'BETWEEN' operator, which of the following statements is true regarding its inclusivity?
Which referential action is equivalent to 'NO ACTION' in terms of immediate constraint checking?
Advanced Database Concepts Review
Introduction
Welcome to the Advanced Database Concepts Review course. This module is designed for computer‑science students and professionals who want to deepen their understanding of relational database theory, SQL nuances, and entity‑relationship modeling. Throughout the lesson, we will explore key topics such as ACID properties, Unicode data types, weak entities, query execution order, many‑to‑many relationships, referential actions, the SELECT DISTINCT clause, and total participation constraints. Each section is crafted to be SEO‑friendly, using clear headings and keyword‑rich descriptions to help you find the information you need quickly.
1. ACID Properties – Focus on Durability
Database transactions must satisfy the four ACID properties: Atomicity, Consistency, Isolation, and Durability. While all four are essential, the question “Which ACID property ensures that a transaction's effects remain after a system crash?” highlights Durability.
- Durability guarantees that once a transaction is committed, its changes are permanently recorded on stable storage (e.g., disk) and survive power failures, crashes, or other system errors.
- Implementation techniques include write‑ahead logging, checkpointing, and using non‑volatile memory.
- Understanding durability helps you design fault‑tolerant applications and choose appropriate recovery strategies.
2. Storing Unicode Strings in SQL Server
When dealing with multilingual data—such as Vietnamese characters—you need a data type that supports Unicode. The correct choice is NVARCHAR(n).
- NVARCHAR stores Unicode data using the UTF‑16 encoding, allowing any language character set.
- It is variable‑length, so it uses only the space required for the actual characters plus a small overhead.
- Contrast this with
VARCHAR, which stores non‑Unicode data and can lead to garbled text for international characters.
Tip: Always use NVARCHAR (or NCHAR for fixed‑length) when your application must support multiple languages.
3. Mapping Weak Entities to Relational Schemas
A weak entity lacks a primary key of its own and depends on an owning (strong) entity. To represent a weak entity in a relational schema, you create a composite primary key that combines:
- The partial key (attributes that uniquely identify the weak entity within its owner).
- The foreign key referencing the owner’s primary key.
This composite key ensures both uniqueness and referential integrity. Avoid using surrogate keys alone, as they would break the logical dependency between the weak entity and its owner.
4. Query Execution Order – The Role of HAVING
SQL query processing follows a logical order. After the GROUP BY clause aggregates rows, the HAVING clause is evaluated next. It filters groups based on aggregate conditions.
WHEREfilters rows before grouping.HAVINGfilters after grouping, allowing conditions likeHAVING COUNT(*) > 5.- Finally,
ORDER BYsorts the result set.
Understanding this order helps you write efficient queries and avoid logical errors.
5. Converting Many‑to‑Many Relationships
In relational design, a many‑to‑many relationship cannot be represented directly. Instead, you create an associative (junction) table that contains:
- The primary key of the first entity (as a foreign key).
- The primary key of the second entity (as a foreign key).
- A composite primary key formed by these two foreign keys, ensuring each pair is unique.
This table may also hold additional attributes describing the relationship (e.g., enrollment date in a Student‑Course junction).
6. Referential Actions – SET NULL
When a referenced primary key is deleted, you can define how dependent foreign keys react. The action SET NULL automatically updates the foreign key column to NULL, preserving referential integrity without deleting the dependent row.
- Use
ON DELETE SET NULLin the foreign key definition. - Other actions include
CASCADE(delete dependent rows),RESTRICT(prevent deletion), andNO ACTION(defer error).
Choosing the right referential action depends on your business rules and data‑consistency requirements.
7. Effect of SELECT DISTINCT
The SELECT DISTINCT clause removes duplicate rows from the result set based on all selected columns. It does not:
- Group rows by a single column only.
- Filter out
NULLvalues. - Sort the output (though many databases implicitly sort to eliminate duplicates).
Use DISTINCT when you need a list of unique combinations, such as distinct customer locations or product categories.
8. Total Participation Constraint in ER Diagrams
A total participation constraint indicates that every instance of an entity must participate in a relationship at least once. In ER diagrams, this is shown by a double line connecting the entity to the relationship.
- Contrast with partial (optional) participation, depicted by a single line.
- Total participation often translates to a
NOT NULLforeign key in the relational schema.
Recognizing total participation helps you enforce mandatory relationships in your database design.
Conclusion
By mastering these advanced concepts—ACID durability, Unicode data types, weak entity keys, query execution order, many‑to‑many junction tables, referential actions, DISTINCT semantics, and total participation—you will be better equipped to design robust, scalable, and internationalized databases. Review each section, practice with real‑world scenarios, and apply the principles to your own projects for lasting mastery.
