Chapter 3. SQL Basics

You might have noticed that I barely mentioned SQL in the preceding chapter. Remember this equation:

  • SQL ≠ Relational model

SQL is based on the relational model but doesn't implement it faithfully. One departure from the model is that in SQL, primary keys are optional rather than mandatory. Consequently, tables without keys will accept duplicate rows, rendering some data inaccessible. A complete review of the many disparities is beyond the scope of this book (see the “Learning Database Design” sidebar in “Tables, Columns, and Rows” in Chapter 2). The upshot of these discrepancies is that DBMS users, and not the DBMS itself, bear the responsibility for enforcing a relational structure. Another result is that the Model and

Get SQL: Visual Quickstart Guide, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.