DQL definition and basic queries

Read(867) Label: basic queries,

This subsection mainly illustrates DQL definition and basic queries with DQL.

Suppose the user wants to query data in the above composite table emps.ctx. Let’s look at how DQL lets them make the query through simple operations in the interface without having to know about the database table’s structure. It is simple, only several steps are enough to get it done effortlessly.

As you have learned how to define a pseudo table in the previous chapter and make the data source ready, let’s move on to create a metadata file using the defined pseudo table and then explain the uses of the DQL model in DQL queries.

Step1: Generate DQL table from pseudo table

Open demo.glmd where the pseudo table is defined in Metadata Editor. First, generate a DQL table by clicking Tool - Generate table from pseudo table:

 

All potential pseudo tables and corresponding in-memory tables/table sequences are automatically selected in the pop-up window.

When a table under “Pseudo table” is a defined pseudo table, all fields and special fields under “Field” are automatically checked, such as emps shown above.

 

When a table under “Pseudo table” is an in-memory table/table sequence, all fields under “Field” are automatically checked.

Click “OK”:

 

Click “Save” to finish creating the DQL table for the metadata file. The more complicated metadata definition will be illustrated later.

Step 2: Perform simple DQL query

Now we can perform a DQL query. Click Tool - DQL query:

 

Double-click table name emps and the DQL query statement will be automatically displayed in the edit box. By default, all fields, including the foreign key and pseudo fields, in the table will be queried.

 

Click “Execute” button to view the result data:

 

You can also query data of the selected fields.

See Join query syntax to for writing custom query statements.