<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.hgotoh.jp/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>努力したWiki - documents:database</title>
        <description>推敲の足りないメモ書き多数</description>
        <link>https://wiki.hgotoh.jp/</link>
        <lastBuildDate>Sat, 18 Apr 2026 12:41:13 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>https://wiki.hgotoh.jp/_media/wiki/logo.png</url>
            <title>努力したWiki</title>
            <link>https://wiki.hgotoh.jp/</link>
        </image>
        <item>
            <title>SQLでデータベーステーブルの縦･横変換</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0001</link>
            <description>SQLでデータベーステーブルの縦･横変換

2006年07月10日

クエリを思いつかなかった子のために。これはあくまでヒントだぞ。
以降の例では Oracle9iリリース２で説明しています。

テーブルの横→縦変換</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>SQLインジェクションはWebアプリだけで発生するとは限りません</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0002</link>
            <description>SQLインジェクションはWebアプリだけで発生するとは限りません

2016/01/08

Bing Webマスターツールの指摘に従っていくつか修正。ついでに文面も修正。

2008/05/04

Webアプリが外部に公開されているから事例が多く発生して見えるだけです。
人知れず自分の担当する「Webアプリではないシステム」でも起きている可能性が大きいのです。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 20 Mar 2024 12:53:43 +0000</pubDate>
        </item>
        <item>
            <title>SQLServer2005のレコード長</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0003</link>
            <description>SQLServer2005のレコード長

2009年06月16日 09時54分41秒

CHAR型の限界


 1&gt; create table t1 (
 2&gt;   a char(8000)
 3&gt;  ,b char(61)
 4&gt; );
 5&gt; go
 メッセージ 1701、レベル 16、状態 1、サーバー GUNTRA、行 1
 7 バイトの内部オーバーヘッドを含めて、最小行サイズが 8068 になるので、テーブル &#039;t1&#039; を作成または変更できませんでした。こ
 のサイズは、テーブル行の最大許容サイズの 8060 バイトを超えています。
 1&gt; create table t1 (
 2&gt;   a char(8000)
 3&gt;  ,b char(60)
 4&gt; );
 5&gt; go
 メッセージ 1701、レベル 16、状態 1、サーバー GUNTRA、行 1
 7 バイトの内部オーバーヘッドを含めて、最小行サイズが 8067 になるので、テーブル &#039;t1&#039; を作成または変更できませんでした。こ
 のサイズは、テーブル行の最大許容サイズの 8060 バイトを超えています。
 1&gt; c…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>Oracle 表領域作成テンプレート</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0004</link>
            <description>Oracle 表領域作成テンプレート

2008年09月05日 02時11分56秒

Oracleの表領域作成メモ。

Create Tablespace


 CREATE TABLESPACE &quot;SAMPLETS&quot;
    LOGGING
    DATAFILE &#039;D:\\oracle\\oradata\\SAMPLE\\SAMPLE01.DBF&#039; SIZE 300M AUTOEXTEND ON,
             &#039;D:\\oracle\\oradata\\SAMPLE\\SAMPLE02.DBF&#039; SIZE 300M AUTOEXTEND ON,
             &#039;D:\\oracle\\oradata\\SAMPLE\\SAMPLE03.DBF&#039; SIZE 300M AUTOEXTEND ON,
             &#039;D:\\oracle\\oradata\\SAMPLE\\SAMPLE04.DBF&#039; SIZE 300M AUTOEXTEND ON,
             &#039;D:\\oracle\\oradata\\SAMPLE\\SAMPLE0…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>sqliteでセッションという概念が通じるか試してみる</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0005</link>
            <description>sqliteでセッションという概念が通じるか試してみる

2012/07/14

Androidのsqliteでinsert後にクローズしてからselectしてる、って話を聞いたので、表題のような疑問がわいた。

今回試したのはAndroidのものでなくFreeBSD版なので、同じことをAndroidでも試す必要は当然ある。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>SQLで各グループ中の最大値を持つレコードに印を付けたい</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0006</link>
            <description>SQLで各グループ中の最大値を持つレコードに印を付けたい

2014年8月29日

Oracle 11g Release 11.1 で説明しています。

お客さんへの説明でいろいろやったんでついでに自分の資料用に作ってしまった。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>ライブツアーのセットリストを公演毎に横に並べる ...</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0007</link>
            <description>ライブツアーのセットリストを公演毎に横に並べる SQL動的生成＆UNION利用編

2015/12/13

　某『UNION使う方法もどうせなんだし載せちゃおうゼ！』

　私『…はい』

どうしても横方向が可変の出力に対応したい場合は、動的なSQL組み立てを行って対応します。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 20 Nov 2025 09:31:14 +0000</pubDate>
        </item>
        <item>
            <title>SQLでTOP3ランキングをやりたい</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0008</link>
            <description>SQLでTOP3ランキングをやりたい

2016年8月14日

PostgreSQL 9.5.4 で説明してますが、Oracle でも可能な筈。

夏休み直前に後輩Hシー氏から振られた話題を記録しておく。



下準備

今回のデータは、</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>SQLで時間の集計を行う</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0009</link>
            <description>SQLで時間の集計を行う

2017年10月24日

ちょっと調べものしてしまったので自分用メモ。

処理対象データ

PostgreSQLに以下のデータがある。


$ psql -h dbsvr05 kamonohashi kamo
psql (9.5.9, サーバー 9.6.1)
WARNING: psql major version 9.5, server major version 9.6.
         Some psql features might not work.
&quot;help&quot; でヘルプを表示します.

kamonohashi=&gt; \d timelog
       テーブル &quot;public.timelog&quot;
  列  |          型          |  修飾語
------+----------------------+----------
 id   | integer              | not null
 grp  | character varying(3) |
 time | character varying(5) |
イン…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>SQLで不足レコードを補うクエリの発行</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0010</link>
            <description>SQLで不足レコードを補うクエリの発行

2017年11月16日

自分用メモ。

処理対象データ

PostgreSQLに以下のデータがある。


$ psql -h 192.168.1.30 kamonohashi kamo
psql (9.6.5)
&quot;help&quot; でヘルプを表示します.

kamonohashi=&gt; select * from salelog;
         day         | item  | qty
---------------------+-------+-----
 2017-10-01 00:00:00 | ITEM1 |  30
 2017-10-02 00:00:00 | ITEM2 |  15
 2017-10-02 00:00:00 | ITEM3 |  20
 2017-10-11 00:00:00 | ITEM1 |  25
 2017-10-13 00:00:00 | ITEM1 |  15
 2017-10-13 00:00:00 | ITEM2 |   5
(6 行)

kamonohashi=&gt;…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>SQLで移動平均を算出</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0011</link>
            <description>SQLで移動平均を算出

2020/01/08

平均値格納行がおかしかったので修正。

2020/01/08

職場のTRSHM君に煽られたんでちょっと書く。

概要

	*  直近3日の移動平均を出すサンプルコードを掲示する。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>Oracleのアカウント有効期限を無期限にする</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0012</link>
            <description>Oracleのアカウント有効期限を無期限にする

2021-02-09

日記のバックアップ “2016-10-18 Oracle 覚書” から抜粋。

sqlplus コマンドから Oracleのアカウントの有効期限を無期限に変更できる。


sqlplus / as sysdba
 
alter profile default limit password_life_time unlimited;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>Oracle EM を非SSL化する</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0013</link>
            <description>Oracle EM を非SSL化する

2021-02-09

日記のバックアップ“2016-10-18 Oracle 覚書”から抜粋。

osのコンソールから emctl コマンドで操作する。


emctl stop dbconsole
emctl unsecure dbconsole
emctl start dbconsole</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 14 Apr 2023 02:32:17 +0000</pubDate>
        </item>
        <item>
            <title>指定時間幅でまとめる</title>
            <link>https://wiki.hgotoh.jp/documents/database/sql-0014</link>
            <description>指定時間幅でまとめる

2024/03/19 おまけ追加

2024/03/18 ヒントだけ

サンプルデータ

こういうデータがあったとします。



連続した2秒以内の塊を得る

項目DEVID毎に、連続した2秒以内のレコード群を一つのグループに纏めたいという要求がありました。</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 19 Mar 2024 02:15:33 +0000</pubDate>
        </item>
        <item>
            <title>140.データベース関連</title>
            <link>https://wiki.hgotoh.jp/documents/database/start</link>
            <description>140.データベース関連</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 01 Nov 2024 15:58:34 +0000</pubDate>
        </item>
    </channel>
</rss>
