2014-02-12から1日間の記事一覧
#!/bin/awk function addmonth(yyyymm, n){ yyyy = substr(yyyymm,1,4) mm = substr(yyyymm,5,2) + n time = mktime(yyyy" "mm" 1 0 0 0") return strftime("%Y%m", time) } { print addmonth(201301, 1) == 201302 ? "." : "NG"; print addmonth(201312, 1)…
テーブルを作成するには、create table の他、select into でもOK 作成元にしたテーブルのカラム制約が、新しいテーブルに引き継がれる。 ただし、IndexやPrimaryKey制約は 引き継がれない。 select * into test_table2 from test_table1 -- sample select *…
age カラムを追加する例 alter table test_table1 add age int default 99 alter table test_table1 add age int null指定の位置に追加することは不可能?
"name" カラムの定義を varchar に変更する alter table t1 modify name varchar(10)"name" カラムの定義を null に変更する。カラムの型は省略可能。 alter table t1 modify name varchar(10) null alter table t1 modify name null reference official doc…