
Answer-first summary for fast verification
Answer: [ManagerEmployeeKey] [int] NULL
## Analysis of Requirements To meet the specified requirements, we need to add a column that establishes a relationship between employees and their managers while enabling efficient attribute lookups. ### Key Requirements Breakdown: 1. **Identify current manager of employees** - Requires a reference to the manager 2. **Support employee reporting hierarchy** - Requires a self-referencing relationship 3. **Fast lookup of manager attributes** - Requires efficient foreign key relationships ### Evaluation of Options: **Option A: `[ManagerEmployeeID] [smallint] NULL`** - ❌ Uses business key (EmployeeID) instead of surrogate key - ❌ Smallint data type may limit future scalability (max 32,767 values) - ❌ Business keys can change, making foreign key relationships unstable **Option B: `[ManagerEmployeeKey] [smallint] NULL`** - ✅ Uses appropriate surrogate key naming convention - ❌ Smallint data type is insufficient for enterprise-scale employee databases - ❌ Data type mismatch with potential primary key (typically int) **Option C: `[ManagerEmployeeKey] [int] NULL`** - ✅ Uses surrogate key naming convention (EmployeeKey) - ✅ Int data type provides sufficient range for large organizations - ✅ NULL constraint supports employees without managers (top-level executives) - ✅ Enables efficient foreign key relationships for fast attribute lookups - ✅ Supports recursive queries for organizational hierarchy **Option D: `[ManagerName] [varchar](200) NULL`** - ❌ Denormalized approach violates database normalization principles - ❌ No referential integrity - names can change without proper updates - ❌ Inefficient for hierarchy traversal and reporting - ❌ Does not support fast lookup of other manager attributes ### Optimal Solution Rationale: **Option C is the optimal choice** because: 1. **Surrogate Key Usage**: Using `ManagerEmployeeKey` references the surrogate key rather than business key, providing stability and consistency in relationships. 2. **Data Type Consistency**: The `int` data type matches typical primary key implementations and supports large-scale employee databases without range limitations. 3. **Hierarchy Support**: This self-referencing foreign key enables recursive queries to build complete organizational hierarchies using Common Table Expressions (CTEs). 4. **Performance Optimization**: Foreign key relationships enable efficient joins to retrieve manager attributes like name and job title from the same table. 5. **NULL Handling**: The NULL constraint properly handles employees without managers (e.g., CEO, top executives). 6. **Best Practices Alignment**: This approach follows dimensional modeling best practices for data warehousing in Azure Synapse Analytics dedicated SQL pools. This design allows users to identify managers, traverse reporting hierarchies, and efficiently access manager attributes through simple JOIN operations while maintaining data integrity and scalability.
Ultimate access to all questions.
No comments yet.
Author: LeetQuiz Editorial Team
You have a table in an Azure Synapse Analytics dedicated SQL pool that was created using the following Transact-SQL statement:
You need to alter the table to meet these requirements:
Which column should you add to the table?

A
[ManagerEmployeeID] [smallint] NULL
B
[ManagerEmployeeKey] [smallint] NULL
C
[ManagerEmployeeKey] [int] NULL
D
[ManagerName] varchar [blocked] NULL