Created
September 23, 2025 07:00
-
-
Save hymkor/3ed3ef042f1e65904e688c93a290d95f to your computer and use it in GitHub Desktop.
SQLite3 の日時型テスト用テーブル作成 DDL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE datetime_test ( | |
| id INTEGER PRIMARY KEY, | |
| -- 文字列(TEXT)形式 | |
| d_date DATE, -- "YYYY-MM-DD" | |
| d_time TIME, -- "HH:MM:SS" | |
| d_datetime DATETIME, -- "YYYY-MM-DD HH:MM:SS" | |
| -- ISO8601拡張 (TEXT) | |
| d_iso8601 TEXT, -- "YYYY-MM-DDTHH:MM:SSZ" など | |
| -- UNIX 時刻 (INTEGER) | |
| d_unix_sec INTEGER, -- 秒単位 | |
| d_unix_milli INTEGER, -- ミリ秒単位 | |
| -- 浮動小数でのUNIX時刻 (REAL) | |
| d_unix_real REAL -- 例: 1695385200.0 | |
| ); | |
| INSERT INTO datetime_test | |
| (d_date, d_time, d_datetime, d_iso8601, d_unix_sec, d_unix_milli, d_unix_real) | |
| VALUES | |
| ('2025-09-22', | |
| '14:30:00', | |
| '2025-09-22 14:30:00', | |
| '2025-09-22T14:30:00Z', | |
| strftime('%s', '2025-09-22 14:30:00'), | |
| CAST(strftime('%s', '2025-09-22 14:30:00') AS INTEGER) * 1000, | |
| CAST(strftime('%s', '2025-09-22 14:30:00') AS REAL) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment