Lazy Diary @ Hatena Blog

PowerShell / Java / miscellaneous things about software development, Tips & Gochas. CC BY-SA 4.0/Apache License 2.0

SQL

SQLite: Count the number of records in multiple tables with a shell script

Background In SQLite, you can list the name of tables with the .tables command or the following SQL: SELECT name FROM sqlite_master WHERE type = 'table' and name NOT LIKE 'sqlite_%' Problem You can't list the number of columns of multiple …

IN clause with 100,001 entries in Oracle

Background You will get the following error when you specify over 1000 entries in IN clause in Oracle: ORA-01795: maximum number of expressions in a list is 1000 This is by design, and the following document says "You can specify up to 100…

OracleでIN句に100,001個のエントリを指定する

背景 OracleでIN句の内容が1000個を超えると以下のエラーが発生する。 ORA-01795: maximum number of expressions in a list is 1000 これはOracleの仕様で、以下のドキュメントに"You can specify up to 1000 expressions in expression_list."と記載されて…

Ordinaly SELECT clause returns ORA-00904 error on Oracle in SQL Fiddle

SQL

Context The "Text to DDL" feature on SQL Fiddle generates DDL like below for Oracle 11g R2. CREATE TABLE Table1 ("value1" int) ; INSERT ALL INTO Table1 ("value1") VALUES (1) SELECT * FROM dual ; Problem This ordinal SELECT clasuse returns …

Return value of comparison operator in SELECT clause

SQL

Background Some RDBMS can contain the result of comparison operator in SELECT clause. However, the returned values are different between RDBMS. Result MySQL I used MySQL 5.6 on SQL Fiddle. DDL (MySQL) CREATE TABLE Table1 (`value1` int, `va…