Chapter 2 �� weather �ơ��֥�� cities �ơ��֥��פ��Ф��Ƥ����������Ĥ��Τ褦����������ͤ��Ƥߤޤ��礦��cities �ơ��֥�˰��פ�����ܤ�⤿�ʤ��Ԥ��������Ф� weather �ơ��֥�������Ǥ��ʤ��������Ȥ��ޤ�������ϥǡ����������������������ȸƤФ�ޤ����Ǥ�ñ��ʥǡ����١��������ƥ�Ǥ� cities �ơ��֥�˰��פ���Ԥ�¸�ߤ��뤫�ɤ����ޤ�į��ơ��������Ƥ��鿷�� weather �쥳���ɤ��ɲä��뤫���ݤ��뤫��(�ޤ�ޤ�Ȥ��äƤ褤���ɤ���)��������Ƥ���Ȥ����ޤ������μ�ˡ�Ͽ�¿���������ޤ�Ǥ��뤳�ȡ������ƤȤäƤ����ؤǤ����� PostgreSQL �����äƺ�Ȥ��Ƥ���ޤ���
�����Υơ��֥������Ϥ��Τ褦�ˤʤ�ޤ���
CREATE TABLE cities ( city varchar(80) primary key, location point ); CREATE TABLE weather ( city varchar(80) references cities, temp_lo int, temp_lo int, prcp real, date date );
�Ǥ�̵���ʥ쥳���ɤ��������Ƥߤޤ��礦��
INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
ERROR:<unnamed> referential integrity violation - key referenced from weather not found in cities
���������ˤ�뿶���ץꥱ�������˸�����Ĵ�¤���ޤ��������Υ��塼�ȥꥢ��ǤϤ�����������ˤϿʤߤޤ�������˾����ߤ�������PostgreSQL �桼�����������������������������������������Ѥ���褦�ˤ���ȴְ㤤�ʤ��ǡ����١������ץꥱ�������μ�����夵���ޤ��ΤǿȤˤĤ��褦�����Ǥ���������