Calculating... until our next FREE Code-Along Session. Secure your spot now

Build Your First Web App Today

Your 14-Day Free Trial Is Waiting To Be Activated
GET INSTANT ACCESS READ MORE ABOUT FIVE

Build a Database from Scratch In Minutes

Avatar photo
Dominik Keller
Nov 21st, 2023
Blog

Here’s How to Build a Database from Scratch With Five

There are a lot of different ways to build a database from scratch. Here we explore an easy and fast way, using Five, a database application builder that offers the functionality of traditional, more code-heavy database administration tools, such as MySQL Workbench or phpMyAdmin in a more user-friendly interface, plus a whole bunch of useful app development features.

In addition to letting users create a MySQL database from scratch, Five also offers other application development features, such as developing forms, charts, dashboards, or reports linked to your database.

Let’s review some core database concepts before delving deeper into building a database from scratch.

Note: if you have landed here because you would like to build your database engine from scratch using tools such as B-Tree, we recommend this Github article instead.



Core Database Concepts

A relational database stores data in a particular format using tables and fields.

A database table stores information about a particular “thing”. For example, your database may include a table called “Customer” which stores data about customers, such as first name, last name, email, phone number, and address. These items – first name, last name, etc. – are the database fields.

To give another example: your business may have a product database used to keep track of products and their details: prices, SKUs, country of origin, variations, etc. Again, anything that describes a product would be a field in your “Product” table.

Most databases are relational databases and they relate data to each other by connecting tables through relationships.

The most common relationships between tables are one-to-many or many-to-many relationships.

Relationships are created through keys.

Each record in a database table comes with a primary key, a unique identifier for the record. For example, if your customer database contains one million customers, there’s a good chance that two customers share the same name. How can you identify unique records in this case? That’s where the primary key comes in. A primary key is always unique to each record and uniquely identifies each record (in our case: customer) in your database table.

A foreign key on the other hand creates the relationship between two tables. By inserting one table’s primary key into another table, it becomes a foreign key and a relationship is established between these two tables. T

Relational databases are typically shown in Entity-Relationship Diagrams (ERDs), which show all database tables, fields, and relationships in an easy-to-understand diagram.

Here’s an example of a database diagram for a stock portfolio application that keeps track of buys and sells.

Five.Co - Database Modeler

It’s important to understand how databases store data before creating a new database from scratch. Mistakes in database design are difficult to rectify, so it’s best to spend time thinking about each table, their fields and how they relate to each other.

Now, let’s go ahead and build a database from scratch.


Build a Database from Scratch in 5 Steps

Step 1: Get Started with Five

First things first: make sure to sign up for free access to Five.


Build A Database from Scratch
Get Started with Five for Free and Start Developing



Remember, you don’t have to pay anything to develop database applications with Five. You only have to subscribe to one of our paid plans if you decide to host your application on Five’s managed cloud, which gives you a custom URL to access your database or share it with your application users.

After signing up, make sure to check your email box (including your spam folder) for an email from noreply@five.co. This email contains a link to your development environment.

Now that you are up and running, it’s time to start building!

Five.Co - Landing Page

TIP: Our User Community

If at any point you are hitting a roadblock or don’t know how to continue, check out our user community. Here you can find answers to the most common questions that people have when using Five.


Step 2: Start Developing

Five is running and you’re ready to delve into your first app development project. What’s the best place to get started?

Follow our YouTube tutorial on how to build a membership application. This seven-step tutorial will take you through the entire process of building an app with Five, from database modeling to previewing your finished application.

Step 1 of our YouTube tutorial explains how to create a database from scratch in Five.

The video also shows how to assign different SQL data types to your table fields, as well as how to inspect your database schema visually using Five’s database modeler. Last, it explains how Five automatically adds primary keys to all your tables.

The video explains important database concepts and puts them into practice.


A Note on Primary Keys and Foreign Keys in Five

The primary keys that Five adds to your tables are Globally Unique Identifiers (GUIDs), 128-bit text strings that represent an identification. GUIDs are great primary keys because the odds of two GUIDs colliding are one in 2¹²², which is a phenomenally small number. So don’t worry about creating your own primary keys. Five manages this part for you.

If you would like to create related tables, then Five can also be used to add a Foreign Key to another table. Simply use Five’s Table Wizard to do so.


Step 3: Where to Find Help

Any new tool comes with a learning curve and so does Five. For those already familiar with SQL, Five is quite intuitive. Five heavily relies on standard SQL concepts, such as relationships, primary and foreign keys, data views and queries.

For those new to relational databases or those who are creating their very first database from scratch, the learning curve can be a bit steep at the start. So, where can we find help if we don’t know how to continue?

Our user community and YouTube channel contain many helpful resources.

On top of this, there is a lot of in-product help in Five.

To access the help and documentation, click on the Help icon in the top right corner. You may not find an answer to your every question, but the help is quite comprehensive and covers a lot of the most commonly asked questions.


Step 4: Launching Your Application

If you are only using Five to create a database from scratch, then you will primarily use Five’s Data features, which let you create your database, add tables and fields, and inspect your database schema visually.

But this is just one of Five’s features: you can build entire database-driven applications with Five.

For example, use Five to build a front-end on top of your MySQL database and turn your database into a modern web app. Or convert an Excel sheet into a web app using Five’s Import Data feature. There are plenty of features in Five that let you add more and more features to your database. To follow along, keep watching the YouTube playlist linked at the top!

Last but not least, there are two more important things to know about Five.

1. You can always preview your application by clicking the Run button in the top right corner of Five.

Five.Co-Run-Your-Application

2. You have used Five to build a database from scratch and have developed an application on top of it. Then now it’s time to launch your application to the web!

To do so, sign up for one of our hosted plans, starting from as little as US$27.49 per application and month, and get a hosted, fully provisioned database and a custom URL for your web app.


Step 5: Working With Templates and Getting Inspiration

If you are building a database from scratch, coming up with your database schema is probably the hardest and most time-consuming part.

To provide some inspiration, check out our use cases, some of which come with template applications (and we’re adding more and more templates weekly). By importing one of our template applications into Five, you can take a shortcut to your development and build on top of what the template already provides.

We also provide free themes which can be used to customize the way your application looks.

Five can be used to build any kind of data-driven web app: from inspection checklists to complex custom-built inventory systems.

Share your use case with us on the forum, and we’re happy to guide you in your development journey!


Start developing your first application!

Get Started For Free Today

Sign Up Free Book a demo

Build Your Web App With Five

200+ Free Trials Started This Week

Start Free

Thank you for your message!

Our friendly staff will contact you shortly.

CLOSE