The following sections describe some conventions that are used in this course.

Typography

SQL keywords are written in all uppercase letters, as in SELECT.

SQL tables are spelled with a capital letter for the initial letter of each word in the table name, as in Accounts or BugsProducts. SQL columns are spelled in lowercase, and words are separated by underscores, as in account_name.

Literal strings are written in lowercase, as in bill@example.com.

Terminology

SQL is correctly pronounced “ess-cue-ell,” not “see-quell.” Though there is no objection to the latter being used colloquially, the former one is used in this course. Thus, in this course, we will read phrases like “an SQL query,” not “a SQL query.”

In the context of database-related usage, the word “index” refers to an ordered collection of information. The preferred plural of this word is “indexes.” In other contexts, an index may mean an indicator and is typically pluralized as “indices.” Both are correct according to most dictionaries, and this causes some confusion among writers. In this course, the plural is spelled as “indexes.”

In SQL, the terms “query” and “statement” are somewhat interchangeable, and refer to any complete SQL command that we can execute. For the sake of clarity, we have used “query” to refer to SELECT statements and “statement” for all other statements—including INSERT, UPDATE, and DELETE, as well as data definition statements—in this course.

Entity-Relationship Diagrams

The most common way to diagram relational databases is with Entity-Relationship Diagrams. Tables are shown as boxes, and relationships are shown as lines connecting the boxes, with symbols at either end of the lines describing the cardinality of the relationship. Examples of Entity-Relationship Diagrams are given below.

Many-to-one relationship

The following figure depicts a many-to-one relationship. Each account may log many bugs.

One-to-many relationship

The following figure depicts a one-to-many relationship. Each bug may have many comments.

One-to-one relationship

The following figure depicts a one-to-one relationship. Each product has one installer.

Many-to-many relationship

The following figure depicts a many-to-many relationship. Each product may have many bugs, and a bug may pertain to many products.

Many-to-many relationship with intersection table

The following figure also depicts a many-to-many relationship as above, but we have added an intersection table.