Docker and MySQL

Containers are all the rage, and Docker is the container engine of choice these days.  So, I wanted to provide this tutorial for setting up a MySQL server instance in a Docker container.

[Read more…]

Learning SQL

For those new to it, SQL can be difficult initially to wrap your head around.  One of the reasons is because it requires a different type of thinking from other languages like Java, Python, or C. You have to learn to think in sets (remember all those Venn diagrams from various places throughout school?). [Read more…]

Database Design – The ER Model

The Entity-Relationship Model is a data model that helps us describe the organization of data for a particular scenario (business, or some other need).  It was developed by Peter Chen and originally published in 1976.  What we get is an abstract representation of the data by viewing the problem in terms of entities and relationships (that exist among the entities).  Here are some good references for the ER Model:

Some terms and concepts to pay attention to:

  • Entity vs. Entity Set
  • Relationship vs. Relationship Set
  • Attribute
  • Key, Primary Key, etc.
  • Relationship Cardinalities (1:1, 1:M, M:N)
  • Relationship Constraints (Total or Partial)

Different ER Model Notations:

 

SQL

SQL is the language of relational databases.  Solving problems efficiently with SQL will require you to think in sets rather than procedurally.  Hopefully our foray into relational algebra has helped you hone those skills.  Some reading:

  • Pro MySQL by Kruckenberg and Pipes (APress Publisher) – Chapter 7: Essential SQL.  The book is available in PDF through the SMU Central University Libraries Website.
  • SQL Tutorial

The Relational Model

As we being our foray into the world of database systems, our first stop is at the Relational Model of Data.  In the relational model, some of the basic components are tuples, relations, and relationships.  It was originally developed and proposed in the late 60’s by E. F. Codd.  Perhaps one of the most influential papers related to the relational model is Codd’s “A Relational Model of Data for Large Shared Data Banks“.

Here are some of the topics we will cover right now [Read more…]