{ Data Modeling with SQL. }


By the end of this chapter, you should be able to:

  • Define what data modeling is
  • Diagram relationships between tables


As you start to build and design more schemas and larger systems, it becomes essential to diagram and model what the relationships between tables looks like.

Data modeling is the process of documenting a complex design into a more easily understood diagram. Depending on the way we doing data modeling, we can use certain languages, rules, text, or symbols to represent the way data needs to flow. Let's discuss one of the more common ways of diagraming relationships between entities, using an ERD (Entity Relationship Diagram)


An entity relationship diagram (ERD) shows the relationships of entity sets stored in a database. An entity in this context is a component of data. In other words, ER diagrams illustrate the logical structure of databases. You can read more about them here

Data Modeling in Practice

Not only will you find yourself doing data modeling exercises in interviews, it's almost always done when building a new application, project or feature. In interviews, you're usually asked to design some type of application, and many times this starts by discussing what features need to be built and how the application should be architected. Understanding how to diagram and lay out a schema is essential for success in these kinds of exercises. Let's try a couple exercises to practice schema design!

Data Modeling Exercises

  1. Design the schema for an application like WhatsApp! How would you handle functionality for 1:1 messaging, read receipts and notifications?
  2. Design the schema for an application like Twitter! How would you handle displaying a users timeline, followers and favorited tweets?
  3. Design the schema for Rithm's online courses! How do we structure each of the courses and sections that they contain?

When you're ready, move on to Database Performance


Creative Commons License