Understanding Data and Databases

Data Design

When designing how your database will structure your data, first we break up our data into different units called models. Each model is a description of what one record of data should look like.

  • Their current address
  • The address they are purchasing
name: string
phone: string
email: string
residence: address
target property: address
street: string
state: string
zipcode: string
  1. One to Many: Every X has many Ys, and every Y has one X
  2. Many to Many: Every X can have many Y’s, Every Y can have many X’s
  • The collection or tables of data are named the plural form of the model lowercase (cats)
  • cat: Sniffles the cat who is 8 years old (instance/record/document)
  • cats: The collection of data on all items that are a Cat. (collection/table)

Types of Databases

  • Relational Databases (SQL Databases)
    These kinds of databases structure data inset columns and rows, so each collection (table) must have a schema (list of columns) before saving individual units of data (records). Almost all relational databases use Structured Query Language (SQL) as the language for talking to the database to create, retrieve, update and delete data.
  • Document Databases (Mongo, DynamoDB, CosmosDB, Firestore)
    These kinds of databases save the data in a schema-less text representation. Because of the more flexible data shape, you can save a lot more data in a lot less space but doesn’t have the same benefits of outlining relationships in your data that a relational database would have. Document databases save data in documents (one cat) in a collection (cats). Different document databases have syntax specific to their platform for formulating queries, no unifying language like SQL/CQL here.
  • Graph Databases don’t cluster data into a collection but instead, every unit of data is a free-standing node. Instead of grouping data, relationships between individual nodes are details by creating edges. Let’s lay there is one node representing “John” and another “Steve you may see something like this.
(Steve) ---brotherOf--->  (John)
(John) ---brotherOf---> (Steve)

Using a Database

In particular for Document and Relational databases, most programming languages have libraries called Object Document Mappers (ODM) and Object Relational Mappers (ORM). These libraries will usually take a schema of your data models and bind them to an object in the programming language with several built-in methods to manipulate that particular data in the database.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex Merced Coder

Alex Merced Coder


Alex Merced is a Developer Advocate for Dremio and host of the Web Dev 101 and Datanation Podcasts.