For Scientific Research
Photo: © Stanza. Used with permission.
Today we will use an example to review data models and create a database design using MySQL Workbench.
Please open up MySQL Workbench so you can follow along.
We will use the design to automatically create the database tables.
As we design the database on the screen, you should also create the same database design in MySQL Workbench on your own computer.
Structured Narrative:
-
Technician prepares prepared sample from sample using preparation method.
-
Technician performs lab test on prepared sample using test method.
The entities have been italicized. We will assume that all necessary computer interactions (i.e. data entry steps) are included in the "prepares" and "performs" actions.
And putting them in a table...
Entity | Relationship | Entity | Relationship | Entity |
---|---|---|---|---|
Technician | prepares | prepared sample | from | sample |
-> | using | preparation method | ||
Technician | performs | lab test | on | prepared sample |
-> | using | test method |
Photo: John Nolan / Katie Mello / Star Wars Blog
Working together, we will create this EER diagram in MySQL Workbench.
Explain our EER diagram.
Photo: John Nolan / Katie Mello / Star Wars Blog
Using the "Forward Engineer" feature, we can save a schema file and create tables. The tables can be explored in "SQL Editor".
In order to use these tables for generating a website with a framework (like CakePHP), we will need to make our table names plural to conform with the framework's conventions.
By adding more tables, we can track additional entities:
- Measurement Units
- Sample Type (Matrix)
- Clients
- Sample Disposal
- Instruments
- Analytes
And even so, we still are not tracking containers or "splits".
With a few shell commands, we can create a functioning web application from our database schema. More on that later!
- Structured Query Language (SQL)
- Database Applications and Web Frameworks
- Embedded SQL
|
|
|
- MySQL WB Reference Manual
- SQL Integrity Constraints
- Database Schema
- Schema
- SQLite vs MySQL vs PostgreSQL: A Comparison Of Relational Database Management Systems
Image: © Nevit Dilmen / Wikimedia
If you welcome chaos, chaos is gonna organize itself for you, in front of your own eyes.
--Philippe Petit on Creative Chaos
Image: Wiros / Wikimedia