Changes

Jump to: navigation, search

Creating MINT Domains

2,090 bytes added, 20:36, 13 October 2014
no edit summary
=== Tables ===__NOEDITSECTION__
In the left-hand pane, all the tables available in the chosen schema (in this case, the '''public''' schema of the staging area) are displayed. Each table required for the domain can be select either by double-clicking on it, or by highlighting it and using the arrows in the middle of the screen, between the two panes.
 
In the example mentioned, two tables are required: '''acccident''' and '''accdeviceinfo'''. In MINT, they are prefixed with '''public_''', indicating that they reside inside the schema called '''public'''.
[[File:MINT_domain_designer_tables.png|center|900px]]
 
{{Note|In this tab, only '''tables''' of the database are displayed. If views need to be queried, this can be achieved via derived tables as described in the next section.}}
=== Derived Tables ===__NOEDITSECTION__
A '''derived table''' is the result of any query that can be run on the database. Let's look at the following example: assume that the requirement it to create a table displaying the number of accidents by year. Although the date of the accident is available as an attribute, let's create another attribute holding only the year of the accident, not the month and day. In PostgreSQL, this can be achieved with the following query:
<pre>
SELECT extract(year from dateofaccident) as year_of_accident FROM accident
</pre>
A derived table can be as simple as this query. However, since the derived table needs to be joined to the other tables (in this example, specifically to the '''accident''' table), the unique identifier of the row should be selected as well, leading to the following query:
<pre>
SELECT accident_guid, extract(year from dateofaccident) as year_of_accidnet FROM accident
</pre>
Enter this query in the '''Query (required)''' pane, give it a name in the '''Query ID (required)''' field, and click on '''Run Query'''. If the query runs successfully on the database specified for the domain, the attributes returned by the database are displayed. Select both fields and click on '''Select Table'''. The derived table now appears in the left-hand pane, under '''Available objects'''. The symbol suggests that it is a ''derived'' table, as opposed to a ''normal'' database table.
[[File:MINT_domain_designer_derived_tables.png|center|900px]]
=== Display ===__NOEDITSECTION__
[[File:MINT_domain_designer_display.png|center|900px]]
[[File:MINT_domain_designer_display_detail.png|center|900px]]
== Edit a domain ==__NOEDITSECTION__
1,068
edits

Navigation menu