List:Commits« Previous MessageNext Message »
From:paul.dubois Date:November 22 2010 11:36pm
Subject:svn commit - mysqldoc@docsrva: r23918 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-5.5 refman-5.6 refman-6.0
View as plain text  
Author: paul
Date: 2010-11-23 00:36:25 +0100 (Tue, 23 Nov 2010)
New Revision: 23918

Log:
 r65877@frost:  paul | 2010-11-22 17:35:22 -0500
 Remove ancient 'twins project' section


Modified:
   trunk/refman-4.1/renamed-nodes.txt
   trunk/refman-4.1/tutorial.xml
   trunk/refman-5.0/renamed-nodes.txt
   trunk/refman-5.0/tutorial.xml
   trunk/refman-5.1/renamed-nodes.txt
   trunk/refman-5.1/tutorial.xml
   trunk/refman-5.5/renamed-nodes.txt
   trunk/refman-5.5/tutorial.xml
   trunk/refman-5.6/tutorial.xml
   trunk/refman-6.0/tutorial.xml

Property changes on: trunk
___________________________________________________________________
Name: svk:merge
   - 07c7e7b4-24e3-4b51-89d0-6dc09fec6bec:/mysqldoc-local/mysqldoc/trunk:35498
07c7e7b4-24e3-4b51-89d0-6dc09fec6bec:/mysqldoc-local/trunk:44521
4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:43968
4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/trunk:44480
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:65873
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:39036
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/trunk:39546
   + 07c7e7b4-24e3-4b51-89d0-6dc09fec6bec:/mysqldoc-local/mysqldoc/trunk:35498
07c7e7b4-24e3-4b51-89d0-6dc09fec6bec:/mysqldoc-local/trunk:44521
4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/mysqldoc/trunk:43968
4767c598-dc10-0410-bea0-d01b485662eb:/mysqldoc-local/trunk:44480
7d8d2c4e-af1d-0410-ab9f-b038ce55645b:/mysqldoc-local/mysqldoc:65877
b5ec3a16-e900-0410-9ad2-d183a3acac99:/mysqldoc-local/mysqldoc/trunk:14218
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/mysqldoc/trunk:39036
bf112a9c-6c03-0410-a055-ad865cd57414:/mysqldoc-local/trunk:39546


Modified: trunk/refman-4.1/renamed-nodes.txt
===================================================================
--- trunk/refman-4.1/renamed-nodes.txt	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-4.1/renamed-nodes.txt	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 0; 551 bytes

@@ -128,6 +128,7 @@
 table-optimization myisam-optimization 2010-11-05
 thread-packages porting 2011-10-20
 truncate truncate-table 2010-11-24
+twin tutorial 2011-11-22
 unnamed-views from-clause-subqueries 2011-10-06
 upgrade upgrading 2011-04-10
 upgrade-downgrade upgrading-downgrading 2011-04-10


Modified: trunk/refman-4.1/tutorial.xml
===================================================================
--- trunk/refman-4.1/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-4.1/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4066,258 +4066,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Modified: trunk/refman-5.0/renamed-nodes.txt
===================================================================
--- trunk/refman-5.0/renamed-nodes.txt	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.0/renamed-nodes.txt	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 0; 551 bytes

@@ -215,6 +215,7 @@
 table-optimization myisam-optimization 2010-11-05
 thread-packages porting 2011-10-20
 truncate truncate-table 2010-11-24
+twin tutorial 2011-11-22
 unnamed-views from-clause-subqueries 2011-10-06
 upgrade upgrading 2011-04-10
 upgrade-downgrade upgrading-downgrading 2011-04-10


Modified: trunk/refman-5.0/tutorial.xml
===================================================================
--- trunk/refman-5.0/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.0/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4023,258 +4023,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Modified: trunk/refman-5.1/renamed-nodes.txt
===================================================================
--- trunk/refman-5.1/renamed-nodes.txt	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.1/renamed-nodes.txt	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 0; 551 bytes

@@ -216,6 +216,7 @@
 table-optimization myisam-optimization 2010-11-05
 thread-packages porting 2011-10-20
 truncate truncate-table 2010-11-24
+twin tutorial 2011-11-22
 unnamed-views from-clause-subqueries 2011-10-06
 upgrade upgrading 2011-04-10
 upgrade-downgrade upgrading-downgrading 2011-04-10


Modified: trunk/refman-5.1/tutorial.xml
===================================================================
--- trunk/refman-5.1/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.1/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4010,258 +4010,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Modified: trunk/refman-5.5/renamed-nodes.txt
===================================================================
--- trunk/refman-5.5/renamed-nodes.txt	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.5/renamed-nodes.txt	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 1, Lines Deleted: 0; 543 bytes

@@ -110,6 +110,7 @@
 source-notes-linux linux-installation 2011-10-23
 sunos installing 2011-10-21
 thread-packages porting 2011-10-20
+twin tutorial 2011-11-22
 unnamed-views from-clause-subqueries 2011-10-06
 upgrade-downgrade upgrading-downgrading 2011-04-10
 upgrade upgrading 2011-04-10


Modified: trunk/refman-5.5/tutorial.xml
===================================================================
--- trunk/refman-5.5/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.5/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4010,258 +4010,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Modified: trunk/refman-5.6/tutorial.xml
===================================================================
--- trunk/refman-5.6/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-5.6/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4009,258 +4009,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Modified: trunk/refman-6.0/tutorial.xml
===================================================================
--- trunk/refman-6.0/tutorial.xml	2010-11-22 21:12:31 UTC (rev 23917)
+++ trunk/refman-6.0/tutorial.xml	2010-11-22 23:36:25 UTC (rev 23918)
Changed blocks: 1, Lines Added: 0, Lines Deleted: 252; 8051 bytes

@@ -4010,258 +4010,6 @@
 
   </section>
 
-  <section id="twin">
-
-    <title>Queries from the Twin Project</title>
-
-    <indexterm>
-      <primary>Twin Studies</primary>
-      <secondary>queries</secondary>
-    </indexterm>
-
-    <indexterm>
-      <primary>queries</primary>
-      <secondary>Twin Studies project</secondary>
-    </indexterm>
-
-    <para>
-      At the places the early MySQL was developed (Analytikerna and
-      Lentus), the founders did systems and field work for a big
-      research project. This project was a collaboration between the
-      Institute of Environmental Medicine at Karolinska Institutet
-      Stockholm and the Section on Clinical Research in Aging and
-      Psychology at the University of Southern California.
-    </para>
-
-    <para>
-      The project involved lots of data collection from all twins in
-      Sweden older than 65 Years (see
-      <ulink url="http://ki.se/ki/jsp/polopoly.jsp?d=9610&amp;l=en"/>).
-    </para>
-
-    <para>
-      Large parts of the project were administered with a Web interface
-      written using Perl and MySQL.
-    </para>
-
-    <section id="twin-pool">
-
-      <title>Find All Nondistributed Twins</title>
-
-      <para>
-        The following query was used to determine what twins should be
-        studied further after a initial screening. This was written
-        around 1997 using MySQL 3.19.
-      </para>
-
-<programlisting>
-SELECT
-    CONCAT(p1.id, p1.tvab) + 0 AS tvid,
-    CONCAT(p1.christian_name, ' ', p1.surname) AS Name,
-    p1.postal_code AS Code,
-    p1.city AS City,
-    pg.abrev AS Area,
-    IF(td.participation = 'Aborted', 'A', ' ') AS A,
-    p1.dead AS dead1,
-    l.event AS event1,
-    td.suspect AS tsuspect1,
-    id.suspect AS isuspect1,
-    td.severe AS tsevere1,
-    id.severe AS isevere1,
-    p2.dead AS dead2,
-    l2.event AS event2,
-    h2.nurse AS nurse2,
-    h2.doctor AS doctor2,
-    td2.suspect AS tsuspect2,
-    id2.suspect AS isuspect2,
-    td2.severe AS tsevere2,
-    id2.severe AS isevere2,
-    l.finish_date
-FROM
-    twin_project AS tp
-    /* For Twin 1 */
-    LEFT JOIN twin_data AS td ON tp.id = td.id
-              AND tp.tvab = td.tvab
-    LEFT JOIN informant_data AS id ON tp.id = id.id
-              AND tp.tvab = id.tvab
-    LEFT JOIN harmony AS h ON tp.id = h.id
-              AND tp.tvab = h.tvab
-    LEFT JOIN lentus AS l ON tp.id = l.id
-              AND tp.tvab = l.tvab
-    /* For Twin 2 */
-    LEFT JOIN twin_data AS td2 ON p2.id = td2.id
-              AND p2.tvab = td2.tvab
-    LEFT JOIN informant_data AS id2 ON p2.id = id2.id
-              AND p2.tvab = id2.tvab
-    LEFT JOIN harmony AS h2 ON p2.id = h2.id
-              AND p2.tvab = h2.tvab
-    LEFT JOIN lentus AS l2 ON p2.id = l2.id
-              AND p2.tvab = l2.tvab,
-    person_data AS p1,
-    person_data AS p2,
-    postal_groups AS pg
-WHERE
-    /* p1 gets main twin and p2 gets his/her twin. */
-    /* ptvab is a field inverted from tvab */
-    p1.id = tp.id AND p1.tvab = tp.tvab AND
-    p2.id = p1.id AND p2.ptvab = p1.tvab AND
-    /* Just the screening survey */
-    tp.survey_no = 5 AND
-    /* Skip if partner died before 65 but allow emigration (dead=9) */
-    (p2.dead = 0 OR p2.dead = 9 OR
-     (p2.dead = 1 AND
-      (p2.death_date = 0 OR
-       (((TO_DAYS(p2.death_date) - TO_DAYS(p2.birthday)) / 365)
-        &gt;= 65))))
-    AND
-    (
-    /* Twin is suspect */
-    (td.future_contact = 'Yes' AND td.suspect = 2) OR
-    /* Twin is suspect - Informant is Blessed */
-    (td.future_contact = 'Yes' AND td.suspect = 1
-                               AND id.suspect = 1) OR
-    /* No twin - Informant is Blessed */
-    (ISNULL(td.suspect) AND id.suspect = 1
-                        AND id.future_contact = 'Yes') OR
-    /* Twin broken off - Informant is Blessed */
-    (td.participation = 'Aborted'
-     AND id.suspect = 1 AND id.future_contact = 'Yes') OR
-    /* Twin broken off - No inform - Have partner */
-    (td.participation = 'Aborted' AND ISNULL(id.suspect)
-                                  AND p2.dead = 0))
-    AND
-    l.event = 'Finished'
-    /* Get at area code */
-    AND SUBSTRING(p1.postal_code, 1, 2) = pg.code
-    /* Not already distributed */
-    AND (h.nurse IS NULL OR h.nurse=00 OR h.doctor=00)
-    /* Has not refused or been aborted */
-    AND NOT (h.status = 'Refused' OR h.status = 'Aborted'
-    OR h.status = 'Died' OR h.status = 'Other')
-ORDER BY
-    tvid;
-</programlisting>
-
-      <para>
-        Some explanations:
-      </para>
-
-      <itemizedlist>
-
-        <listitem>
-          <para>
-            <literal role="func">CONCAT(p1.id, p1.tvab) + 0 AS
-            tvid</literal>
-          </para>
-
-          <para>
-            We want to sort on the concatenated <literal>id</literal>
-            and <literal>tvab</literal> in numeric order. Adding
-            <literal>0</literal> to the result causes MySQL to treat the
-            result as a number.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>id</literal>
-          </para>
-
-          <para>
-            This identifies a pair of twins. It is an index in all
-            tables.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>tvab</literal>
-          </para>
-
-          <para>
-            This identifies a twin in a pair. It has a value of
-            <literal>1</literal> or <literal>2</literal>.
-          </para>
-        </listitem>
-
-        <listitem>
-          <para>
-            Column <literal>ptvab</literal>
-          </para>
-
-          <para>
-            This is an inverse of <literal>tvab</literal>. When
-            <literal>tvab</literal> is <literal>1</literal> this is
-            <literal>2</literal>, and vice versa. It exists to save
-            typing and to make it easier for MySQL to optimize the
-            query.
-          </para>
-        </listitem>
-
-      </itemizedlist>
-
-      <para>
-        This query demonstrates, among other things, how to do lookups
-        on a table from the same table with a join
-        (<literal>p1</literal> and <literal>p2</literal>). In the
-        example, this is used to check whether a twin's partner died
-        before the age of 65. If so, the row is not returned.
-      </para>
-
-      <para>
-        All of the above exist in all tables with twin-related
-        information. We have an index on both <literal>id,
-        tvab</literal> (all tables), and <literal>id, ptvab</literal>
-        (<literal>person_data</literal>) to make queries faster.
-      </para>
-
-      <para>
-        When we did this work, our production machine was a 200MHz
-        UltraSPARC, and on that old hardware this query returned about
-        150 to 200 rows in less than one second. The main table had
-        70,000 Rows.
-      </para>
-
-    </section>
-
-    <section id="twin-event">
-
-      <title>Show a Table of Twin Pair Status</title>
-
-      <para>
-        Each twin has a status code called <literal>event</literal>. The
-        query shown here is used to select all twin pairs combined by
-        event. This indicates in how many pairs both twins are finished,
-        in how many pairs one twin is finished and the other refused,
-        and so on.
-      </para>
-
-<programlisting>
-SELECT
-        t1.event,
-        t2.event,
-        COUNT(*)
-FROM
-        lentus AS t1,
-        lentus AS t2,
-        twin_project AS tp
-WHERE
-        /* We are looking at one pair at a time */
-        t1.id = tp.id
-        AND t1.tvab=tp.tvab
-        AND t1.id = t2.id
-        /* Just the screening survey */
-        AND tp.survey_no = 5
-        /* This makes each pair only appear once */
-        AND t1.tvab='1' AND t2.tvab='2'
-GROUP BY
-        t1.event, t2.event;
-</programlisting>
-
-    </section>
-
-  </section>
-
   <section id="apache">
 
     <title>Using MySQL with Apache</title>


Thread
svn commit - mysqldoc@docsrva: r23918 - in trunk: . refman-4.1 refman-5.0 refman-5.1 refman-5.5 refman-5.6 refman-6.0paul.dubois23 Nov