Search Google Appliance

Information Technology

Article Details

Add a Database Activity to Moodle

We're taking you to an updated version of this article.

UMass Amherst Information Technology support articles are now updated in the new IT Knowledge Base. We found an updated version of this article, so we're sending you there.

Taking you to:
Redirecting in

Stay here to view this page in the legacy Support Center.
Information may be outdated as these articles are no longer maintained.

Find answers to your tech questions in the new IT Knowledge Base.

UMass Amherst Information Technology support articles are now updated in the new IT Knowledge Base.

This article is part of our archived legacy Support Center and may be outdated or inaccurate.
We did not find an updated version of this article. That means this archived content is more likely to be outdated or no longer relevant.
Check the new IT Knowledge Base for updated information:

More tech help options

The Database activity allows students and/or instructors to populate, display, search, and comment on a bank of record entries. The format and structure of these entries is highly customizable, with the option to include images, files, URLs, numbers, check boxes, and text. Versatile settings options make the Database activity well suited for many different kinds of assignments, such as collecting and sharing information, giving students a data array to work with, and presenting content for students to comment on.

Consider the simpler Moodle Glossary activity if you only need to build a collection of terms and definitions. For more detail for Glossary activity, see Add a Glossary Activity in Moodle.

Note: With flexibility comes a fair amount of complexity. If you are considering creating a Database activity for your course, we recommend contacting the Instructional Media Lab at 413-545-2823 for assistance.

Part One: Add the Database Activity & Configure Submission Options

To add a Database activity to your Moodle course, first, you will configure the submission options for making entries, availability, grading, groups, etc. After completing this step, you will need to open the activity to your students.

  1. On your course page, click Turn editing on (green pencil icon Screen shot of Turn editing on icon, top right).
  2. In the Section where you want the Database activity to apprear, click + Add an activity or resource. The Activity chooser dialog will open.
  3. In the Activity chooser dialog, select Database. A description will be displayed at right.
  4. Click Add. The Adding a new Database page will open.
  5. Configure the Database options. The page opens with General, EntriesAvailability, and Ratings (if you want to grade) settings in view. Select topic headings to make additional settings, or select Expand all (top right) to view all possible settings. For more information on these options, see Database Options (below), or click the help icon (click the "?" icon for tips on option settings) next to any option.
  6. Select Save and return to course to return to your main course page, or Save and display to view the Database activity page.

Note: The Database activity cannot be used until fields and templates have been defined. To add fields and templates, please see Part Two: Set up Entry Fields and Select a Layout Template below.

 Database Options


  • Database name (required)
    This name displays as a link on your course page. Use something unique that clearly identifies this Database from other course activities. We also recommend keeping the name short.
  • Description (optional)
    Enter a summary of the Database and instructions. You can also Display description on course page. Select this option to display the description underneath the Database link on your course page. (This works best if the description is very concise).


View and adjust the record entry settings.

  • Approval required
    Allows you to require that an instructor or TA approve each entry before other students can view it.
  • Allow editing of approved entries
    Allows the users who added their entries to edit or delete the approved entries. If disabled, approved entries are no longer editable or deletable by the user who added them.
  • Allow comments on entries
    Allows users to comment on each other's entries. Note: The Comments option will display when users view entries individually, but not when viewing a list of all database entries.
  • Entries required before viewing
    The number of entries a student must submit before they can see entries by other students.
  • Maximum number of entries
    The maximum number of entries a student can submit before they are blocked from adding more.


View and adjust the database availability settings.

  • Available from/to
    The dates the database is visible to students and new entries can be added.
  • Read only from/to
    The dates the database is available for viewing, but not open for data entry.


Assign the Database acitivity to a given category in your Gradebook.


View and adjust how instructors and TAs will grade entries. 

  • Roles with permission to rate 
    Identifies users who have permission to rate items. Once the Database activity is created, the list of roles may be changed via the permissions link. To change the permissions, navigate and select the Database activity, next select the Actions menu (Screen shot of Actions Menu, located on the right) and from the Actions menu drop-down list, select Permissions
    Note: This feature is not enabled until the activity is created.
  • Aggregate type
    Determines how the ratings are entered as a grade in the Moodle Gradebook. The options are: No ratings, Average of ratings, Count of ratings, Maximum rating, Minimum rating, and Sum of ratings.
  • Scale
    Sets the maximum score for the activity. 
    Note: For the "Sum of ratings" aggregate type, select the maximum for the sum of all ratings (the total grade for the activity), not the maximum for each rating.
  • Restrict ratings to items with dates in this range
    Limits the time frame during which items are available for rating. Check the box to enable the drop-down date windows.

Common module settings

View and adjust the database visibility and group settings.

  • Availabiltiy
    Sets whether or not an assignment is visible to students. By default, new assignments are set to Show. (This is comparable to using the Hide/Show icon for the activity on your course page.)
  • ID Number
    Sets an ID number to provide a way of identify the activity or resource for purposes such as grade calculation.
  • Group mode and Grouping
    These options let you restrict the assignment to particular groups of students you have already created in Moodle. For more information, see Assign an Activity to a Group or Grouping in Moodle.

Restrict access 

To add restrictions on accessing the activity click Add restriction. The Add restriction window will open, containing the following options:

  • Date - Prevent access until (or from) a specified date and time.
  • Grade - Require students to achieve a specified grade.
  • User profile - Control access based on fields within the student’s profile.
  • Restriction set - Add a set of nested restrictions to apply complex logic.​

If you have groups in your course, you will see the following additional options:

  • Group - Allow only students who belong to a specified group, or all groups.
  • Grouping - Allow only students who belong to a group within a specified grouping.

Note: The Database activity cannot be used until fields and templates have been defined (see below).

Part Two: Set up Entry Fields and Select a Layout Template

Select Database Fields

Fields establish the kinds of content that can be added to entries in your database. To add a new field when first setting up your database:

  1. On your course page, click Turn editting on (green pencil icon Turn editing on (green pencil icon, top right), top right).
  2. To add a new Database activity:
    In the Section of your course where you want the Database activity, click +Add an activity or resource, then select Database and click Add. The Adding a new Database page will open. Configure the setting for your Database and click Save and display. Skip to step 3 if you have already created a Database activity.
  3. On your course page, find the Database activity. Click on the name of the database activity. This will open the database page.
  4. Click the Fields tab, and from the Create a new field drop-down menu, select a field type. The types of fields possible are: Checkbox, Date, File, Latlong (latitude/longitude), Menu, Multimenu, Number, Picture, Radio button, Text area, Text input, and URL.
  5. Configure the data fields according to the options provided and then click Add.
  6. Use the Default sort field drop-down menu to choose the order in which fields will display in the database. By default, it is set to display by Time added, and then click Save.

Define Database Templates

Templates determine the visual layout of the database when users are adding a new entry, browsing or searching all existing entries, and viewing one entry at a time. To reduce setup complexity, we recommend creating all database fields before defining templates.

To use the default templates when first setting up your database, click the Templates tab and then click Save template.

Note: The default templates can be modified, but this requires directly editing the template HTML. For assistance customizing a template, contact the Instructional Media Lab at 413-545-2823.

Update Database Templates

If you add a new field to a Database activity after saving templates for the first time, you will need to reset the templates before the field displays to users. To update your database templates:

  1. On your course page, navigate to the Database activity. Click on the name of the Database activity. This will open the Database page.
  2. Under the Field tab, add and define new fields to use (see Select Database Fields above).
  3. Click the Templates tab, then click the Add template tab.
  4. Click Reset template (located on the left) to update the template to include newly added fields.
    Note: Resetting a template will remove any changes you have made to the default template HTML.
  5. Click Save template. This will update the fields users see when adding a new database entry.
  6. Repeat the steps above in the List template, Single template, Add template, and Advanced search template tabs. This will update the fields users see when browsing database entries, viewing one entry at a time, and searching within the database.

Using the Database

  • After you have defined database fields and templates, click Add entry to create entries and populate the Database activity.
  • Once entries have been saved in the database, click View single to view them individually, or click View list to see the entries as a list.
  • To search entries in the database, click Search.

For details and instructions for your students, see Contribute to a Database in Moodle.