Online Documentation for SQL Manager for DB2

MQ Tables


A Materialized query table (MQ table, or MQT) is a table based on a query that is used for the definition of the table and that determines the data included in the table.

 

 

Creating MQ Tables

 

To create a new materialized query table:

Hint: To create a new materialized query table, you can also right-click the MQ Tables node of the DB Explorer tree and select the New MQ Table... context menu item.

 

To create a new materialized query table with the same properties as one of existing materialized query tables has:

Alternatively, you can right-click a materialized query table in the DB Explorer tree and select the Duplicate MQ Table <mq_table_name>... context menu item.

 

Duplicate Object Wizard allows you to select the database to create a new materialized query table in, and to edit the result SQL statement for creating the materialized query table.

 

 

Editing MQ Tables

 

To edit an existing materialized query table:

  • select the materialized query table for editing in the DB Explorer tree (type the first letters of the materialized query table name for quick search);
  • right-click the object and select the Edit MQ Table <mq_table_name>... context menu item, or simply double-click the materialized query table;
  • edit materialized query table definition using the appropriate tabs of MQ Table Editor.

 

Dropping MQ Tables

 

To drop a materialized query table:

  • select the materialized query table to drop in the DB Explorer tree;
  • right-click the object and select the Drop MQ Table <mq_table_name>... context menu item;
  • confirm dropping in the dialog window.

 

Note: If more convenient, you can also use the following shortcuts:

Ctrl+N to create a new MQ table;

Ctrl+O to edit the selected MQ table;

Shift+Del to drop the object from the database.