Db2=>CONNECT TO db_name
Db2=>EXPORT TO absolute_file_path OF DEL SELECT * FROM "table_name"
Db2=>IMPORT FROM absolute_file_path OF DEL INSERT_UPDATE INTO "table_name"
]]>NoSQL据说就是要break these properties= =`IDK why...
SELECT attribute-expression-list FROM relation-list [ WHERE condition ];
attribute-expression-list:
relation-list:
condition:
AND | TRUE | FALSE | NULL |
TRUE | TRUE | FALSE | NULL |
FALSE | FALSE | FALSE | FALSE |
NULL | NULL | FALSE | NULL |
OR | TRUE | FALSE | NULL |
TRUE | TRUE | TRUE | TRUE |
FALSE | TRUE | FALSE | NULL |
NULL | TRUE | NULL | NULL |
NOT | TRUE | FALSE | NULL |
FALSE | TRUE | NULL |
(Q1 and Q2 must have same attribute-list)
Q1 UNION Q2 => Together all the tuples in Q1 and Q2
Q1 INTERSECT Q2 => Only tuples in both Q1 and Q2
Q1 EXCEPT Q2 => Tuples only in Q1 but not in Q2
ALL关键字: 允许重复
UNION ALL will include twice of duplicate tuples
INTERSECT ALL will include all possible pairs of match tuples, duplication possible
EXCEPT ALL will include all "not in Q2" tuples, duplication possible
SELECT ... ... ORDER BY attribute [DESC/ASC], attribute [DESC/ASC], ......
Note: 如果没有指定Order, return的数据可能是任意顺序
{count, sum, avg, min, max} => Aggregate expressions
Order: Group => Having => Aggregate
Note: 没有被group by指定的attribute不能出现在SELECT的attr-list中, 除非是aggregate
INSERT INTO relation-name [( attribute-list )] VALUE ( value-list );
DELETE FROM relation-name [ WHERE condition ];
UPDATE relation-name SET attribute-assignment-list [ WHERE condition ];
attribute-assignment-list:
CREATE TABLE relation-name ( attribute-name attribute-type [constraints-list], ... )
attribute-type: http://www.w3school.com.cn/sql/sql_datatypes.asp
constraints-list: (Constraints的格式在各种数据库中都不太一样, 就不列举了)
CREATE VIEW view-name AS ( SELECT ... )
从View SELECT的方法和table一样
CREATE TRIGGER trigger-name
AFTER UPDATE OF attribute-list ON relation-name
REFERENCING OLD as instance-name(o) NEW as instance-name(n)
FOR EACH ROW ...
不同database语法不一
]]>