From 5a76d663a026f73a209d191e1de803d2ba6b0563 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Fri, 26 Apr 2002 13:55:23 +0000 Subject: [PATCH] automatic joint in QBE example --- ChangeLog | 1 + Documentation.html | 66 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) diff --git a/ChangeLog b/ChangeLog index 03158b3b2..6562e8a78 100755 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ $Source$ * tbl_qbe.php3: automatic joints from Relation table, thanks to Mike Beck (mike.beck at ibmiller.de) (experimental: some things remain to be tested) + * Documentation.html: example for automatic joints 2002-04-26 Alexander M. Turek * libraries/common.lib.php3: fixed a controluser bug. diff --git a/Documentation.html b/Documentation.html index 60f8a05af..1565db127 100755 --- a/Documentation.html +++ b/Documentation.html @@ -593,6 +593,10 @@ $cfg['PmaAbsoluteUri'] = (!empty($HTTPS) ? 'https' : 'http') . '://' display links on the table properties page, to check referential integrity (display missing foreign keys) for each described key. +
  • + in query-by-example, create automatic joints (see an example + in the FAQ, section "Using phpMyAdmin"). +

  • @@ -1533,6 +1537,68 @@ $cfg['PmaAbsoluteUri'] = (!empty($HTTPS) ? 'https' : 'http') . '://' this document.

    +

    + How can I use the relation table in Query-by-example? +
    + Here is an example with the tables persons, towns and countries. Start + by creating this:

    + +      CREATE TABLE countries (
    +        country_code char(1) NOT NULL default '',
    +        description varchar(10) NOT NULL default '',
    +        PRIMARY KEY (country_code)
    +      ) TYPE=MyISAM;
    +
    +      INSERT INTO countries VALUES ('C', 'Canada');
    +
    +      CREATE TABLE persons (
    +        id tinyint(4) NOT NULL auto_increment,
    +        person_name varchar(32) NOT NULL default '',
    +        town_code varchar(5) default '0',
    +        country_code char(1) NOT NULL default '',
    +        PRIMARY KEY (id)
    +      ) TYPE=MyISAM;
    +
    +      INSERT INTO persons VALUES (11, 'Marc', 'S', '');
    +      INSERT INTO persons VALUES (15, 'Paul', 'S', 'C');
    +
    +      CREATE TABLE relation (
    +        src_table varchar(32) NOT NULL default '',
    +        src_column varchar(32) NOT NULL default '',
    +        dest_table varchar(32) NOT NULL default '',
    +        dest_column varchar(32) NOT NULL default '',
    +        PRIMARY KEY (src_table,src_column)
    +      ) TYPE=MyISAM;
    +
    +      INSERT INTO relation VALUES ('persons', 'town_code', 'towns', 'town_code');
    +      INSERT INTO relation VALUES ('persons', 'country_code', 'countries', 'country_code');
    +
    +      CREATE TABLE towns (
    +        town_code varchar(5) NOT NULL default '0',
    +        description varchar(30) NOT NULL default '',
    +        PRIMARY KEY (town_code)
    +      ) TYPE=MyISAM;
    +
    +      INSERT INTO towns VALUES ('S', 'Sherbrooke');
    +      INSERT INTO towns VALUES ('M', 'Montréal');
    +
    +
    + Then test like this: +

    +

    +

    [phpMyAdmin project]