At 13:59 27/3/2004, Ed Smith wrote:
Hi,

Below the results from a server built with BK 4.1 tree 3
days ago:

C:\mysql\bin>mysqld --standalone --console --ansi --default-table-type=innodb
040328  0:36:59  InnoDB: Started; log sequence number 0 43634
mysqld: ready for connections.
Version: '4.1.2-alpha-max-debug'  socket: ''  port: 3306

C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.2-alpha-max-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE person (pid INTEGER, name CHAR(5));
Query OK, 0 rows affected (0.17 sec)

mysql> CREATE TABLE phone (pid INTEGER, num CHAR(10));
Query OK, 0 rows affected (0.16 sec)

mysql>
mysql>
mysql> INSERT INTO PERSON VALUES (1, 'Bob');
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO PERSON VALUES (2, 'Jane');
Query OK, 1 row affected (0.05 sec)

mysql> INSERT INTO PHONE VALUES (1, '12345');
Query OK, 1 row affected (0.07 sec)

mysql> INSERT INTO PHONE VALUES (1, '23456');
Query OK, 1 row affected (0.05 sec)

mysql> INSERT INTO PHONE VALUES (2, '34567');
Query OK, 1 row affected (0.06 sec)

mysql> SELECT PID, (SELECT COUNT(*) FROM PHONE H WHERE
    -> H.pid = P.pid) AS C FROM person P;
+------+---+
| PID  | C |
+------+---+
|    1 | 2 |
|    2 | 1 |
+------+---+
2 rows in set (0.01 sec)

mysql> SELECT PID, (SELECT COUNT(*) FROM PHONE H WHERE
    -> H.pid = P.pid) AS C
    -> FROM person P ORDER BY pid DESC;
+------+---+
| PID  | C |
+------+---+
|    2 | 1 |
|    1 | 2 |
+------+---+
2 rows in set (0.00 sec)


Regards,


For technical support contracts, visit https://order.mysql.com/
Are you MySQL certified?, http://www.mysql.com/certification/

Miguel Angel Solórzano <[EMAIL PROTECTED]>
São Paulo - Brazil



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to