If you are comfortable with client development but a bit new to SQL, use this page as a quick-start for MySQL.
This description relies on examples from the simple Demo Database, which is installed automatically so you can easily explore it.
The operations of creating tables, columns and relationships is described in the following sections. These all occur in the context of a database.
You can create your own database, either in the cloud or on-premise. Even easier, you can request a database be created automatically when you create your account.
phpMyAdmin is a web-based utility to manage data and schema. You can use instead of using DDL (Data Definition Language - a syntax for defining a schema) and DML (Data Manipulation Language - the syntax for creating, reading, updating and deleting data). A link was provided in your registration email.
Relational databases require that you define the structure of your database in what is commonly called a schema. Here you define the tables (objects) and columns (attributes) that comprise your database.
You can follow this procedure to create a table from a spreadsheet. You can create multiple tables using this technique, then relate them together by defining relationships.
A reasonable way to begin database design is to consider your JSON, here a Customer and some Orders (just one Order shown for brevity):
In database parlance, there are two key concepts illustrated here:
To build this with phpMyAdmin, first create the table if it doesn't already exist:
and then press the
Relational databases provide lots of options and power for indices and keys:
The indentation from Customer -> Order represents a one-to-many Relationship. This is directly supported by the DBMS - you can define it, along with actions that govern changes. In Espresso, we informally call these the Parent and Child tables.
Database developers often draw diagrams as shown on the right to document their database structure. It's a great idea. The lines represent the Relationships, where the fork is attached to the child.
You define a Relationship by defining a Foreign Key, wherein the child contains the Primary Key of the Parent. In our example, the
To define a Foreign Key Relationship:
Create the Relationship by selecting the Child Table > Structure > Relation View: