Exams / DP-900 / D2 Identify considerations for relational data on Azure
Describe relational concepts
- Identify features of relational data
- Describe normalization and why it is used
- Identify common structured query language (SQL) statements
- Identify common database objects
What makes data "relational"
A relational database organizes data into tables (relations): data is logically organized in a row-and-column format similar to a spreadsheet, under a schema that is fixed before any data is written (schema-on-write). Every row in a table has the same columns, even though the values differ row to row.
| Trait | Relational database |
|---|---|
| Schema | Defined before data is written, enforced |
| Consistency | Strong, ACID transactions |
| Access | SQL (or a SQL dialect) |
| Best suited for | Structured data, high-volume transactional writes, strong consistency requirements |
Non-relational (key/value, document, graph) stores trade some of this away — for example, most key-value stores only support simple query, insert, and delete operations — in exchange for a flexible schema or massive horizontal scale. A relational database is the right choice specifically when strong consistency guarantees are required.
Database objects
| Object | What it is |
|---|---|
| Table | Database objects that contain all the data in a database — rows and columns |
| View | A virtual table whose contents are defined by a query |
| Index | A structure built on one or more columns that speeds up data retrieval |
| Stored procedure | A group of one or more Transact-SQL statements (or a CLR method) stored and executed by the database engine |
A view doesn't store its own data: it re-runs its underlying query (which can join tables and include calculated columns) every time it's selected from, which is exactly why it's useful for letting several users rerun the same complex query without repeating it.
Clustered vs. nonclustered indexes
Clustered indexes sort and store the data rows in the table or view based on their key values — the index is the physical row order, so a table can have only one. A nonclustered index keeps a separate structure of key values with pointers back to the data rows, without reordering the table itself, so a table can have many nonclustered indexes. An indexed column referenced in a WHERE predicate lets the query optimizer seek directly to matching rows instead of scanning the whole table.
Keys and relationships
- A primary key is a column, or combination of columns, whose values uniquely identify every row in a table.
- Relational databases represent relationships using foreign keys: a foreign key in one table references the primary key of another table, linking the two entities.
When modeling an entity for a relational database: its attributes map to table columns, and each entity maps to its own table; a foreign key is what links two related entities/tables together.
SQL statement categories
| Category | Purpose | Example statements |
|---|---|---|
| DDL (Data Definition Language) | Create, alter, or drop data structures in a database | CREATE, ALTER, DROP |
| DML (Data Manipulation Language) | Insert, update, and change the rows in a database (and read them) | SELECT, INSERT, UPDATE, DELETE |
| DCL (Data Control Language) | Determine which users and logins can access data and perform operations | GRANT, REVOKE, DENY |
A frequent exam trap: DROP removes the whole object (DDL), while DELETE only removes rows from it (DML).
Common T-SQL clauses
SELECT— use the SELECT statement to retrieve rows from the database; it chooses the columns/expressions to project.JOIN...ON— a joined table is a result set that is the product of two or more tables; theONclause supplies the matching condition (e.g.,ON o.Customer = c.ID).WHERE— defines the condition to be met for the rows to be returned (or affected, inUPDATE/DELETE); this is the predicate that lets the optimizer use an index.GROUP BY— a SELECT clause that divides the query result into groups of rows, usually to compute one or more aggregations per group.- Aggregate functions (
MAX,MIN,SUM,AVG,COUNT, ...) — each performs a calculation on a set of values and returns a single value per group.
SELECT SalesDate, AVG(SalesAmount)
FROM Sales
GROUP BY SalesDate
ORDER BY SalesDate;
INSERT INTO <table> (<columns>) VALUES (<values>) — the identifier right after INSERT INTO is the target table; the parenthesized list that follows it names the table's columns.
Normalization
Normalization is the schema-design process that reduces data duplication and helps ensure data integrity: the goal of efficiently processing and storing individual transactions by an OLTP system is partly accomplished through data normalization, which breaks up the data into smaller, less redundant chunks. It structures — never eliminates — relationships between tables, expressing them through keys.
| Fully normalized | Fully denormalized | |
|---|---|---|
| One entity's data lives in | Multiple related tables | A single table |
| Reading one entity | Requires joins across tables | No joins needed |
| Writing one entity | Can require coordinated writes to multiple tables | Writes to a single table |
| Favored by | OLTP (transactional) systems | OLAP/analytics (dimensional) systems |
When you conduct analytics and reporting on data that's highly normalized, the queries tend to be complex, because most queries need to denormalize the data by using joins — which is why analytical systems commonly favor more denormalized, dimensional models than transactional systems do.
Exam traps
- DDL vs. DML vs. DCL —
CREATE/ALTER/DROPdefine structures (DDL);SELECT/INSERT/UPDATE/DELETEtouch row data (DML);GRANT/REVOKE/DENYmanage permissions (DCL).MERGEis DML (it inserts/updates/deletes rows), not DDL. - View vs. table vs. index vs. stored procedure — only a table physically holds data; a view is query-defined; an index only speeds up retrieval; a stored procedure runs code. Don't let a question about "what holds the data" land on a view or an index.
- Clustered vs. nonclustered index — only a clustered index reorders a table's physical storage (one per table); a nonclustered index is a separate lookup structure.
- WHERE lets the optimizer use an index —
SELECTalone orJOINalone don't supply a filtering predicate; it's theWHERE(orON) condition on an indexed column that enables an index seek instead of a full scan. - Normalized ≠ "no relationships" — normalization structures relationships with keys; it does not eliminate them. Expect "Yes/No" statement questions designed to catch this confusion.
- Fully normalized vs. fully denormalized read/write pattern — normalized ⇒ reads/writes can span multiple tables; denormalized ⇒ reads/writes target a single table. These two question variants mirror each other.
- Relational vs. key/value stores and joins — key/value stores are optimized for simple key lookups, not complex multi-table joins; that strength belongs to relational databases.
Docs
- Tables - SQL Server | Microsoft Learn
- Views - SQL Server | Microsoft Learn
- Clustered and nonclustered indexes described
- Index Architecture and Design Guide — SQL Server
- Stored procedures (Database Engine)
- Primary and foreign key constraints
- Relationships in relational databases - Microsoft Learn (EF Core)
- Statements (Transact-SQL): DDL/DML/permissions overview
- SELECT (Transact-SQL)
- FROM clause plus JOIN, APPLY, PIVOT (Transact-SQL)
- WHERE (Transact-SQL)
- GROUP BY (Transact-SQL)
- Aggregate functions (Transact-SQL)
- INSERT (Transact-SQL)
- UPDATE (Transact-SQL)
- GRANT (Transact-SQL)
- Online Transaction Processing (OLTP) - Azure Architecture Center
- Understand Data Models - Azure Architecture Center