Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Using Database.
The list view shows multiple entries, possibly in a more abbreviated form to ensure all the information fits. You may use the controls at the bottom of the screen to search and sort the contents.
- View single: one item at a time
- View list (red arrow): several items at a time (number is user defined)
- Add entry (green arrows): add an item to the database
The icons highlighted in yellow are for editing, viewing and deleting an item in the database.
Alternatively, you may view only one entry at a time. This might allow you to view more detailed information than the list view.
If comments have been enabled, you may add a comment.
If ratings have been enabled, and made viewable, by the database editor, you may grade other database entries, and view these ratings.
Adding an entry
Go to the "Add entry" tab and fill in the form.
If the Database auto-linking filter is enabled, any entries in a database will be automatically linked to where the concept words and/or phrases appear within the same course. This includes forum postings, internal resources, week summaries etc.
Note: If you do not want particular text to be linked (in a forum posting, say) then you should add <nolink> and </nolink> tags around the text. Alternatively the filter can be disabled for a particular activity.
Importing many entries
You can import entries via a CSV file if you click the "Import entries" link in the Database activity administration block. CSV means Comma-Separated-Values and is a common format for text interchange.
The easiest way to determine the format of the text file is to manually add an entry to the database and then export it. The resulting export text file may then be edited and used for importing entries. Here's a sample of what a very simple file will look like.
The expected file format is a plain text file with a list of field names as the first record. The data then follows, one record per line.
The field delimiter defaults to a comma character and the field enclosure is not set by default (field enclosures are characters that surround each field in each record).
Records should be delimited by new lines (usually generated by pressing RETURN or ENTER in your text editor). Tabs can be specified using \t and newlines by \n.
name,height,weight Kai,180cm,80kg Kim,170cm,60kg Koo,190cm,20kg
Note: Certain field types may not be supported.
Do not put spaces after your commas or upload will fail!
After upload page import.php comes back blank if it failed. If successful you'll read a message like, "1 entries saved".
You can export entries either in CSV (comma separated values) or ODS (OpenOffice Calc) formats by clicking the tab at the top or by clicking the "Export entries" link in the Database Activity administration block. (Both CSV and ODS formats can be opened with MS Excel.)
When using the CSV format, the user can select either the comma, semicolon, or tab to separate the fields. The selection of the proper character is important. If users select to use a comma to separate the fields and some of the fields contain data with commas then the number of columns is going to be misaligned and likely cause confusion.
Users can select which fields from the database they wish to have exported. By default, all fields are checked to be included. Choose the fields that you wish to have included in the export.
Once the export type and the fields to be exported have been selected, clicking on the Export entries pushbutton will generate the file. The user will usually have the option of either opening or saving the file.
Exporting to an external portfolio
If an external portfolio such as Mahara has been enabled by the administrator then users have the option to export individual entries to that portfolio. They will see at the bottom of a database entry an "export" icon to click on and select the portfolio to export to:
Moodle.org has three good examples of the database module in action:
- Moodle Buzz, a database of the titles, authors and web links to news articles mentioning Moodle
- Themes, a database with screenshots, download links and user comments about Moodle themes
- Modules and plugins, a database containing a variety of web links (download, documentation, discussion) and info (maintainer, module type, requirements) about the modular components of Moodle, including those created by third parties.
You could use the database module to:
- allow collaboration on building a collection of web links/books/journal references related to a particular subject
- display student created photos/posters/websites/poems for peer comment and review
- gather comments and votes on a shortlist of potential logos/mascot names/project ideas
- provide a student file storage area
- maintain a log of what was done in a face-to-face class each day, so that absent students can get caught up themselves. Example
- Glossary module, which performs a similar though more specialised, text-based role
- Using Moodle book Chapter 12: Databases
- Database for Databases
- Using Moodle Database activity module forum
- Screencast introducing the Database Module and walking through creating a database
- Tracking Students' Reading with the Moodle Database Module presentation
Using Moodle forum discussions: