ITPub博客

首页 > Linux操作系统 > Linux操作系统 > DB2 学习日志

DB2 学习日志

原创 Linux操作系统 作者:zhenyu1986 时间:2009-09-25 19:49:48 0 删除 编辑

本人正在学习BD2,每天会更新我的学习笔记,期望又看我日志的朋友指点一二,感激不尽!

(2) Constraints may include the basic WHERE clause constructs:

  - Basic comparisons (>, <, =, >=, etc.)

  - BETWEEN

  - LIKE

  - IN

   Constraints may NOT include:

  - Subqueries

  - Column functions

  - Special registers (such as CURRENT DATE)

  - On OS/390, the NOT logical operator

    (3) A table can have multiple unique keys, but cannot have more than one primary key. A key can either be defined as unique key or as primary key, but not both. In DB2 UDB for UNIX, Windows and OS/2 and DB2 UDB for AS/400, CREATE TABLE and ALTER TABLE can be used to identify a key as unique key. In DB2 for OS/390, a key can only be defined as unique key by means of the CREATE TABLE statement.

    (4) A trigger is a set of actions that will be executed when a defined event occurs. The

   triggering events can be the following SQL statements.

  • INSERT

  • UPDATE

  • DELETE

    (5) FOR EACH ROW indicates that the trigger should fire for each row inserted. FOR EACH STATEMENT, which causes the trigger to fire once per triggering statement, is another option. The difference between these two options should be obvious if you consider an INSERT that adds more than one row to a table:

— If FOR EACH ROW is used, the triggered action will take place once for each row updated. — If FOR EACH STATEMENT is used, the triggered action will be performed only once, no matter how many rows are updated. 
 
 

(6)In addition:

- You must have the appropriate authorization to insert, update, or delete rows using a view - A view that you can use to update data is subject to the referential constraints and table check constraints for the table upon which the view is ultimately based. - When you use a view to insert a row in a table, the view definition must specify all the columns in the base table that are not nullable and do not have a default value. The row being inserted must contain a value for each of those columns. - When you use a view to update, you can only update columns that are in the view. The columns of the view form. a projection of the base table. You cannot update derived columns, even if they are in the view.

(7)There are three types of Outer Joins:

 - RIGHT OUTER JOIN

 - LEFT OUTER JOIN

- FULL OUTER JOIN

    (8)CASE expressions allow a user to code IF-THEN-ELSE logic instead of simple values.

• DB2 evaluates the conditions in order from top to bottom. The value returned from the CASE expression is the result of the first true condition. If no case is satisfied, the ELSE value is used. If no ELSE is coded, the value returned is NULL.

• CASE expressions can appear in various places in an SQL statement, including the SELECT clause, the WHERE clause, the GROUP BY clause, and the HAVING clause. It can also appear in IN and VALUES clauses.

(9)Casting is often used in programming languages to refer to the process of changing a value from one data type to another. Casting in SQL has the same meaning.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22570045/viewspace-615572/,如需转载,请注明出处,否则将追究法律责任。

上一篇: db2
下一篇: DB2 SF13 学习日志
请登录后发表评论 登录
全部评论

注册时间:2009-09-20

  • 博文量
    7
  • 访问量
    3119