🗃️Database
Creating logically organized databases is key to building your app. You'll learn what a database is, how to structure it, and some killer tips and tricks to help make your databases amazing!
Last updated
Creating logically organized databases is key to building your app. You'll learn what a database is, how to structure it, and some killer tips and tricks to help make your databases amazing!
Last updated
Skill Level: Beginner
Make sure you have signed up for a free Adalo account and are signed in
Be familiar with what a spreadsheet is (Excel or Google Sheets).
You do not need a paid Adalo plan to use this feature
Let's walkthrough how to setup a simple database for a Trip app with different properties, relationships, records, and collections. Please click the In-Depth tab of this walkthrough for more information about these terms.
3.) Name the new Collection "Trips" and click Add
4.) An initial property is provided for you called Name since a collection must always have at least one property, but you can change this property's type, title, and order within the other properties of the collection if there are any. Let's rename this property to "Title" by clicking on it, then filling in the input field.
6.) Rename the new date property something like "Trip Start Date" and click Save.
7.) Every trip needs a trip leader, but we don't want to have to add properties about a trips leader when we already have that information in the User's collection. Instead, let's add a Relationship property in the Trips collection. In the Trips collection, click + Add Property again except this time, choose Relationship, then choose Users. This creates a link between the Trips collection and the Users collection and as a result two properties are actually created - one in the Trips collection and one in the Users collection.
8.) Now Adalo is asking us what type of relationship this is. We can think of this in terms of what role the user plays in the relationship. In this case, a person might be the leader of multiple trips but each trip can only have one leader so we would choose Option 1 here, then click Done.
It is also possible to create this same relationship from the User's collection instead, only this time the logic is being viewed from the opposite collection so we would choose Option 2. Both ways are correct. You can think of this as looking through a pipe from two different ends - what you see from both ends is the same, only mirrored.
9.) Now that we have a Relationship property setup, we can't forget to rename these properties in both the User's collection and the Trips collection. Let's rename the User's collection one "Trips Led" and the Trips collection one "Leader". You can rename them by clicking on the collection, then the relationship property, then filling in the field.
11.) In the top right of the database popup, click on the + Add Trip button. Some inputs will appear for the properties we added like Title and Trip Start Date. Go ahead and fill this in how you like, then click Save. You'll notice that the dropdown for Leader does not contain any options because we don't have any users yet! Why don't you try adding some users manually as well, then link them to some trips?
You can also upload records to your database by Importing a CSV file.
12.) Now that we have a database setup and some records inside it, we can use this data in Lists in our app. We can also create Forms for our users to create and update their own Trips in the database!
Now that you've got the basics of how to build a database, be sure to check out the cloneable version of the app used in this walkthrough by clicking here.
Properties may be left completely empty or not used at all
While One-to-One relationships do not exist in Adalo, sometimes it is necessary to adapt the One-to-Many relationship type for this purpose. These instances are rare, but do crop up from time to time. For example, if an event host can only be assigned one event at a time and the event can only have one host. The "Many" side of the relationship can be disregarded.
The first property in a collection is used by Adalo as the records' label. Typically unique values work best here and it's best not to leave the first property blank.
When uploading a CSV, relationships can only be imported if the value matches the label of the related collection. Typically numbers or IDs work best for this.
When creating properties, be sure to properly name them so you don't get confused later on. This is particularly important for Relationships since it creates properties in both related collections. Don't forget to name the relationship property in the other collection too!
When working with relationships please be aware that the first property on your "related" collection will be the one that will show up in your Relationship. If you are willing to pull another property from your "related" collection, you will have to make this property the first one in the Collection.
If you would like to further understand how to work with Relationships you would want to take our Create a Robust, Flexible Shopping Cart System course from The Adalo App Academy.
If you need additional help with this article, you can always ask in our community forum! Be sure to paste the link to this article in your post as well!
Do you have a tutorial or help doc request? Let us know!
1.) To get started, click on the Database tab on the lefthand menu in the Adalo Builder
2.) You'll notice that a User's collection is provided for you by default - this collection cannot be deleted, only modified. Let's add another collection called Trips by clicking the +Add Collection button
5.) Next let's add a Date property to hold the date that a Trip begins. In the Trips collection, click on the + Add Property button and select Date.
10.) Now we have a basic database for Trips that have a title, start date, and a leader, but we don't actually have any Trips (records) in our database yet. We could build a form so that our users could create and add their own Trips, or we could also add records manually to the Database. To add them manually, just click on the Trips collection then click on the Records button.
In Adalo, anything related to the Database is marked by a magical Red color like you see in the iconic big plus sign . You can access the Adalo Database by clicking on the red Database button in the Adalo Builder:
Properties, including Relationships, can also be visualized as columns in Adalo's database, by clicking on the Records for the Collection which will also display the Records within that collection.