DB2
DB2 éå¼ãWiki - ç´¢å¼ã®ä¸è¦§ã確èªããã«ã¯ãããSYSCAT.INDEXESãã¼ãã«ãç´æ¥åç §ããã°ãããããã -- ãã¹ãç¨ãã¼ãã« CREATE TABLE test ( id INTEGER NOT NULL GENERATED AS IDENTITY, code CHAR(2), name VARCHAR(254), PRIMARY KEY (id) ) in fooâ¦
Unofficial DB2 BLOG - ORDER BYã§NULLãæå°ã«æã£ã¦ããã«ã¯ãåèã«ããã¦ããã ãã¦ã以ä¸ã®ããã«æ¸ãã¦ããã®ã ãã©ã select * from A order by case when id is null then 0 else 1 end, id selectã«distinctãã¤ããã¨ã¨ã©ã¼ã«ã»ã»ã»ã $ db2 "seleâ¦
SQLã®ã¢ã¯ã»ã¹ã»ãã©ã³ã確èªããæé ã®ã¡ã¢ã§ããã¡ãã£ã¨ããã£ã¦ã¿ãã ãã®ç°¡åãªã¡ã¢ãªã®ã§è©³ããã¯ä»¥ä¸ãåç §ã DB2 ãªãã¡ã¬ã³ã¹ - SQL Explain æ©è½ @IT SQLãåæããé«åº¦ãªãã¯ãã㯠DB2éå¼ããªãã¡ã¬ã³ã¹ - EXPLAIN表ãä½æããã«ã¯ æ¦è¦ EXPLAIâ¦
ãã¨ã¤ãã®ä¸å ·åã®å¯¾å¿æ¡ã¨ãã¦æãããå¤é¨çµåã使ãæ¡ãã¨ããµãã¯ã¨ãªã使ãæ¡ãã§ã©ã£ã¡ãæ©ãã試ãã¦ã¿ãã ç°å¢/æ¡ä»¶ç DBã¯MySQLã§ã¯ãªãå®éç¨ã§ä½¿ãDB2ã使ç¨ã ãã¼ãã«ã¯ä»¥ä¸ããã¨ã¤ãã®ãµã³ãã«ããã«ã©ã ãå°ãå¢ããã¦ã¾ãã create tableâ¦
DB2ã§ã¯ãã½ã¼ãæã«NULLå¤ããã£ãå ´åãæ大å¤ãã¨ãã¦æ±ããã¾ãã æé ã§ã¯æå¾ã«ãéé ã§ã¯æåã«ãã¾ãã Integer,Date,Timestampã§å®éã«ç¢ºèªã ãªãã¡ã¬ã³ã¹ã§ã¯ãDB2 9.1 Information Center - å¯é¸æã®ãorder-by-clauseãã¨ããã«è¨è¿°ãããã¾ããâ¦
db2batchã使ã£ã¦ç°¡åã«è¨æ¸¬ã§ãã¾ãã $ echo "<SQL>" | db2batch -d <ãã¼ã¿ãã¼ã¹å>å ·ä½çã«ã¯æ¬¡ã®ãããªæãã $ echo "select * from hoge_table;" | db2batch -d foodbå®è¡çµæã§ãã ...çç¥(SQLã®å®è¡çµæãã¤ãã¤ãã¨è¡¨ç¤ºããã¾ãã) * Elapsed Time is</sql>â¦
ã¾ããã¤ãã¯ã¾ããããªã®ã§ã¡ã¢ã ç¾è±¡ ãµã¼ãã¼ãåæ§ç¯ããããDB2ã®ROW_NUMBERé¢æ°ã®å®è¡ã§ã¨ã©ã¼(SQLSTATE: 42884)ãçºçããããã«ãªã£ãã åããã¼ã¸ã§ã³ã®DB2ãå©ç¨ãã¦ããä»ã®ãµã¼ãã¼ã§ã¯æ£ããåä½ãã¦ããã åãã¢ã¸ã¥ã¼ã«ã使ç¨ãã¦ããä»ã®â¦