You are here
Moodle 3.0, 3.2: Create a Database Activity
Applies to: Moodle 2.8, 3.0, 3.2
A database in Moodle allows an instructor and students to build, display and search a bank of record entries about any topic. The format and structure of these entries can be almost unlimited, including images, files, URLs, numbers and text amongst other things.
Building a database activity takes quite a few steps, but it is a logical process. Once completed, instructors/designers can reuse the structure and share it with others. The most important part of building a database is deciding what types of data you want to collect.
Steps to creating a database:
- Defining and naming database fields
- Adding a new database
- Creating the database fields
- Saving your List and Single templates
- Testing and modifying the database
Fields are the building blocks of your database. Each piece of data you or your students collect must have a field name and a type associated with it. The type refers to the type of data.
- Write a list of the information you want.
- Write a field name for each piece of information. Field names should be brief and descriptive, e.g., Author.
- Write what type of information it is. Field types options in Moodle are:
- Typed text:
- Text input: enter up to 60 characters.
- Text area: enter longer pieces of text.
- Date: pick a date from drop-down menus.
- Number: type any number.
- Uploaded or linked content:
- File: upload a file which others can then download.
- Picture: upload an image file which others can see without downloading.
- URL: enter a web address which then turns into a link.
- A list of options predefined by the instructor (e.g., Type(s) of chocolate: milk, dark, white, semi-sweet):
- Checkbox: check one or multiple options.
- Radio button: select only one option.
- Menu: select only one option from a drop-down menu.
- Multimenu: not recommended, use Checkbox instead.
- Latlong: enter a latitude and longitude for a particular location which can be automatically linked to services like Google Maps.
Example: For a class database to store websites students find while researching their midterm papers, you might have the following field names and types: Website (URL), Date Accessed (Date), Description (Text area), Resource category (Radio button with options: News outlet, Academic journal, Blog, Social media)
- Go to the course homepage and click Turn editing on.
- Click Add an activity or resource in the section where you want to add the Database.
- Select Database and click Add.
- Enter a Name for the database.
- Enter a Description, including instructions for how your students should use the database. You may include information about the kinds of data you want to collect. You can edit this description later if you need to.
- Modify additional settings as desired. Some core database settings include the following:
- Entries: require instructor approval for each entry before other students can view it, allow students to make comments on each others’ entries, and/or set minimum or maximum number of entries an individual student can post.
- Availability: define a period of time students have access to add entries to the database and/or a period of time when students can view the database but not add any more entries.
- Click Save and display.
Once the database is configured, you will see tabs for creating fields and building templates. You are automatically on the Fields tab because you must define fields before moving on.
- Click Choose under Create a new field and choose the appropriate field type.
- Enter a Field name. Keep it short and do not use spaces.
- Enter a Field description if desired. Only instructors and designers see the field description; it is for your benefit to help identify that field.
- Enter or define other field options, depending on the field type.
- When you are done setting up the field, click Add.
- Add additional fields as needed.
- Review your field names and types, and make sure they are correct.
Note: Do not change a field name past this point because your database may not work properly. You can, however, make adjustments to field options; for instance, you can change the display size of a Text area or change the options for a Checkbox.
- When finished, click Save.
Moodle automatically creates two templates for viewing your data: Single template and List template, but you must save them first before using your database.
- Click the Templates tab. A new sub-set of tabs appear.
- Click the Single template tab.
- Scroll down and click Save template.
- Click the List template tab.
- Scroll down and click Save template.
You can make something up when creating these sample records. Later, you can delete the records. You can also create sample records to model what you want students to do.
- Click the Add entry tab.
- Fill in the fields and click Save and add another. The entry is saved, but the form still shows the data you entered. If you click Save and add another again, you will have a duplicate entry.
- Create a few different entries for testing.
- Click Save and view.
- Click the View List tab and view your records on one page.
- Click the View single tab and view your records one at a time.
- If necessary, go back to the Fields tab and modify individual field options, or add a new field. Note: Do not change any field names, because your database may not work properly. You can, however, delete a field entirely and create a new one with a different name.
- Save your field changes.