�����������
�����
������
������� ��������� �������� VPS - ������� ������ �������� Dedicated server
�������:

VPS - �������:

������ ��������:

Dedicated server:


������ ���������:

������ ����������� ��������

www.megastock.ru

Z-Payment
������ ������
Moneybookers
Payment Network
��������
Contact
�������� ������
MasterCard
VISA
������� CONTACT
�������� �������
��� 24
WIRE USD EURO
������ Z-PAYMENT
SMS ������
��������� ����
��������� ������-�����
��������� ComePay
��������� FreeCash

�����������  �������. �������

�������:










MySQL

3.5.6

3.5.6

MySQL 3.23.44 InnoDB ( section 7.5 InnoDB section 1.9.4.5 ).

.

, MySQL ( , InnoDB), (CHECK) , , () , . , :

CREATE TABLE person (
    id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    name CHAR(60) NOT NULL,
    PRIMARY KEY (id)
);

CREATE TABLE shirt (
    id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
    style ENUM('t-shirt', 'polo', 'dress') NOT NULL,
    color ENUM('red', 'blue', 'orange', 'white', 'black') NOT NULL,
    owner SMALLINT UNSIGNED NOT NULL REFERENCES persons,
    PRIMARY KEY (id)
);

INSERT INTO person VALUES (NULL, 'Antonio Paz');

INSERT INTO shirt VALUES
(NULL, 'polo', 'blue', LAST_INSERT_ID()),
(NULL, 'dress', 'white', LAST_INSERT_ID()),
(NULL, 't-shirt', 'blue', LAST_INSERT_ID());

INSERT INTO person VALUES (NULL, 'Lilliana Angelovska');

INSERT INTO shirt VALUES
(NULL, 'dress', 'orange', LAST_INSERT_ID()),
(NULL, 'polo', 'red', LAST_INSERT_ID()),
(NULL, 'dress', 'blue', LAST_INSERT_ID()),
(NULL, 't-shirt', 'white', LAST_INSERT_ID());

SELECT * FROM person;
+----+---------------------+
| id | name                |
+----+---------------------+
|  1 | Antonio Paz         |
|  2 | Lilliana Angelovska |
+----+---------------------+

SELECT * FROM shirt;
+----+---------+--------+-------+
| id | style   | color  | owner |
+----+---------+--------+-------+
|  1 | polo    | blue   |     1 |
|  2 | dress   | white  |     1 |
|  3 | t-shirt | blue   |     1 |
|  4 | dress   | orange |     2 |
|  5 | polo    | red    |     2 |
|  6 | dress   | blue   |     2 |
|  7 | t-shirt | white  |     2 |
+----+---------+--------+-------+

SELECT s.* FROM person p, shirt s
 WHERE p.name LIKE 'Lilliana%'
   AND s.owner = p.id
   AND s.color <> 'white';

+----+-------+--------+-------+
| id | style | color  | owner |
+----+-------+--------+-------+
|  4 | dress | orange |     2 |
|  5 | polo  | red    |     2 |
|  6 | dress | blue   |     2 |
+----+-------+--------+-------+





Prime-Hosting.Ru:













Prime-Hosting.Ru:





Copyright 2008-2010
Prime Hosting
Prime Hosting. , VPS - ,  , dedicated serverPrime Hosting. , VPS - , , dedicated server:
VPS - Dedicated server