A relational database management system (RDBMS) stores structured information in tables. Tables group related data into rows and columns, while relationships let you retrieve connected information from several tables with one SQL query. section 8.0 section 16.1
Think of tables as organized spreadsheets whose rows contain records and whose columns describe each record. The relational part means that separate tables can be connected through shared values, such as an identifier. section 8.0 section 16.1
Finding promotions without orders
Suppose promotion stores available promotions and orderheader stores orders. A left join can keep every promotion, then the WHERE condition can select promotions with no matching order: SELECT p.PromotionCode, oh.OrderID FROM promotion p LEFT JOIN orderheader oh ON p.PromotionID = oh.PromotionID WHERE oh.PromotionID IS NULL; The result identifies promotions that have not been used. section 9.2.4
SELECT
p.PromotionCode,
oh.OrderID
FROM promotion p
LEFT JOIN orderheader oh
ON p.PromotionID = oh.PromotionID
WHERE oh.PromotionID IS NULL;
View the compact SQL version of the left-join example, which demonstrates how an RDBMS combines related tables and filters unmatched records. section 9.2.4
Working with an RDBMS commonly involves:
- Querying tables with SELECT, FROM, WHERE, and GROUP BY. section 14.1.1
- Creating and manipulating tables, where storage choices affect the database design. section 18.0
- Inserting new rows with values appropriate to each column and data type. section 16.1
- Checking SQL logic carefully, especially when combining AND and OR conditions with parentheses. section 5.2.3





