DB2 Common fool question 1000 Q (iii)

Source: Internet
Author: User
Tags db2 lowercase table definition

When you apply DB2, you may encounter some seemingly simple problems, especially for beginners, I have a simple
Summed up, released to everyone, I hope that we can help, but also welcome everyone to discuss together, common development and common progress!

The following are mainly based on db27.x. The following characters are lowercase.

This article for DB2 Master is not to see.
All characters are lowercase.
91. How do I create a DB2 summary table?
DB2 's summary table functionality is similar to the materialized view of Oracle!
The syntax is:
Createsummarytabletable_nameas (fullselect) ...
For example:
Define a summary table that can be refreshed:
Createsummarytabletable_nameas (select*fromtable_name1wherecol1= AAA)
Where datainitiallydeferred stipulates that data cannot be inserted into a table as part of a createtable statement.
Refreshdeferred specify that the data in the table can be refreshed at any time when the refreshtable statement is used!
92. How do I refresh the summary table?
Where sum_table is a summary table.
93. How do I modify the summary table?
Altertablesum_table ...
94. How do I create a temporary table?
As (Fullselect) definitiononly
The first line stipulates the name of the temporary table.
The second row defines the columns of the temporary table.
The third line stipulates that the identity column is not replicated from the source result table definition.
Line four stipulates that if you do not open the Withgold cursor, all rows of the table will be deleted.
Line five provides no record of changes to the table.
For example:
As (SELECT*FROMBSEMPMS) definitiononly
95. Management of views?
How to create a view:
Createviewview_nameasselect*fromtable_namewhere ...
To delete a view:
96. How do I know what the view definition is?
Select*fromsyscat. Text column in the views.
97. How do I create an alias?
The pro_name in the back can be table,view,alias,nickname and so on.
98. How do I create a sequence?
For example:
The first line prescribes the name of the sequence.
The second line sets the starting value of the sequence.
The third line sets the range of the new each time.
There is no maximum numerical limit for the four-line rule.
Line five provides maximum numerical limit.
99. How do I change the sequence?
Altersequencesequence_name ...
Parameters that can be modified
Startwith's Start_number
Increment's VALUE1
Number of Nomaxvalue
Nocycle Property
Maximumnumberofsequencevalues Maximum Value

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.