/ db / test / sql /
/db/test/sql/biography_i_sibrev
1 -- Copyright (C) 2012 The Meme Factory, Inc., http://www.meme.com/
2 --
3 -- This file is part of Gombe-MI.
4 --
5 -- Gombe-MI is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with Gombe-MI. If not, see <http://www.gnu.org/licenses/>.
17 --
18 -- SQL to test on insert of of biography_data that the sib cannot be
19 -- younger than the infant.
20 --
21 -- All data appearing in this work are fictitious. Any resemblance to
22 -- actual data, living or archived, is purely coincidental.
23 --
24 -- Karl O. Pinc <kop@meme.com>
25 --
26
27 -- Delete the sibling, then re-insert with "bad" birthdate
28 -- so as to test insert into biography_data.
29 delete from biography_data
30 where animid = 'SIB';
31
32 --
33 -- Main tables.
34 --
35
36 -- biography_data
37 insert into biography_data (
38 animid
39 , animname
40 , birthgroup
41 , bgcertainty
42 , sex
43 , momid
44 , firstborn
45 , birthdate
46 , bdmin
47 , bdmax
48 , bddist
49 , entrydate
50 , entrytype
51 , departdate
52 , departdateerror
53 , departtype)
54 values
55 ( 'SIB'
56 , 'Some older sibling'
57 , 'K'
58 , 'C'
59 , 'M'
60 , 'MOM'
61 , 'Y'
62 , '2002-01-01'
63 , '2002-01-01'
64 , '2002-01-01'
65 , 'R'
66 , '2002-01-01'
67 , 'B'
68 , '2012-01-01'
69 , 0
70 , 'D');
71
72 select 'Sib must be older than infant in follow: on insert of biography_data' as message;