<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2-ppt DokuWiki" -->
<?xml-stylesheet href="https://tm.root-n.com/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel>
        <title>Tipsというかメモ database:sql:join</title>
        <description></description>
        <link>https://tm.root-n.com/</link>
        <lastBuildDate>Tue, 18 Nov 2025 20:33:46 +0900</lastBuildDate>
        <generator>FeedCreator 1.7.2-ppt DokuWiki</generator>
        <image>
            <url>https://tm.root-n.com/lib/images/favicon.ico</url>
            <title>Tipsというかメモ</title>
            <link>https://tm.root-n.com/</link>
        </image>
        <item>
            <title>database :: SQL/JOIN/いろいろな JOIN</title>
            <link>https://tm.root-n.com/database:sql:join:etc</link>
            <description>下記のようなテーブル「table1」と「table2」で、いろんな JOIN を試します。



sql&gt; SELECT * FROM table1;
+------+------+
| id   | val  |
+------+------+
|    1 | aaa  |
|    2 | bbb  |
|    3 | ccc  |
+------+------+
3 rows in set (0.00 sec)

sql&gt; SELECT * FROM table2;
+------+------+
| id   | val  |
+------+------+
|    1 | xxx  |
|    3 | yyy  |
|    5 | zzz  |
+------+------+
3 rows in set (0.00 sec)</description>
        <category>database:sql:join</category>
            <pubDate>Sun, 16 Mar 2008 22:48:10 +0900</pubDate>
        </item>
        <item>
            <title>database :: SQL/JOIN/自己結合</title>
            <link>https://tm.root-n.com/database:sql:join:self_join</link>
            <description>SNSではよくあることですが、あるユーザとそのユーザの友達関係を管理することになったとします。

例えば、こんなテーブルで管理するのはバッドノウハウです。



+-----------+--------+------------+------------+------------+----
| person_id | name   | friend1_id | friend2_id | friend3_id | … 
+-----------+--------+------------+------------+------------+----
|         1 | taro   |          2 |          3 |            | … 
|         2 | jiro   |          5 |          1 |          7 | … 
|         3 | saburo |          2 |            |            | … 
+-----------+--------+-----…</description>
        <category>database:sql:join</category>
            <pubDate>Sun, 16 Mar 2008 22:48:10 +0900</pubDate>
        </item>
    </channel>
</rss>
