Generic databases

A generic database is a table in which the field names are stored as field values in one column, while the field values are stored in a second. Generic databases are usually used for attributes of different objects.

Look at the example GenericTable below. It is a generic database containing two objects, a ball and a box. Obviously some of the attributes, like color and weight, are common to both the objects, while others, like diameter, height, length and width are not.

GenericTable
object attribute value
ball color red
ball diameter 10 cm
ball weight 100 g
box color black
box height 16 cm
box length 20 cm
box weight 500 g
box width 10 cm

On one hand it would be awkward to store the data in a way giving each attribute a column of its own, since many of the attributes are not relevant for a specific object.

On the other hand, it would look messy displaying it in a way that mixed lengths, colors and weights.

If this database is loaded into Qlik Sense using the standard way and display the data in a table it looks like this:

Data base data displayed in a table.

However, if the table is loaded as a generic database, column two and three will be split up into different tables, one for each unique value of the second column:

Generic data model.

The syntax for doing this is simple:

Example:  

Generic SELECT* from GenericTable;

It does not matter whether a LOAD or SELECT statement is used to load a generic database.

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?