πŸ—ƒοΈ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!

Skill Level: Beginner

Before You Begin

  • 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

An Overview of the Database

Walkthrough

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!

Example

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.

Learn More

  • 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.

pageCollection PermissionspageImporting Records from a CSV FilepageLocation

Help

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!

Last updated