Example Database
Discover how a hypothetical bug-tracking database with its DDL and ERD is used throughout this course to demonstrate SQL antipatterns. Learn the structure and relationships within the example database to better understand how to identify and resolve common SQL challenges in real applications.
We'll cover the following...
Most of the topics in this course are illustrated using a database for a hypothetical bug-tracking application. The DDL and the ERD for the mentioned application are given below.
Data Definition Language for the database
The following Data Definition Language shows how tables are defined. In some cases, choices are made for the sake of examples later in the course, so they might not always be the choices one would make in a real-world application. Mostly, only standard SQL is used, so the example is applicable to any brand of the database. Some MySQL data types also appear, such as SERIAL and BIGINT. The DDL for the database can be seen below. We can also copy and/or download the code.
Entity-Relationship Diagram for the database
The Entity-Relationship Diagram for
this database is shown in the figure given below. Notice the three connections between the Bugs table and the Accounts table, representing three separate foreign keys.
In some chapters, especially those on Logical Antipatterns, different database definitions are shown, either to exhibit the antipattern or to show an alternative solution that avoids the antipattern.