Re: [GENERAL] Checking for changes in other tables

2013-04-28 Thread CR Lender
Sorry for the late reply, I had to give this some time to digest. I'm still trying to wrap my head around the concept that triggers don't "belong" to a table... On 2013-04-26 17:15, Richard Huxton wrote: > On 26/04/13 10:01, CR Lender wrote: > I think this is more a problem of terminology rather t

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread Richard Huxton
On 26/04/13 10:01, CR Lender wrote: I can add a trigger on eu_loans to check if Diane and Betty both live in the EU. The problem is how to prevent one of them from moving to a non-EU country (if they do, the loan has to be cancelled first). They are however allowed to move to other EU countries.

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread Richard Poole
On Fri, Apr 26, 2013 at 11:01:28AM +0200, CR Lender wrote: > Is there any way to ensure that all donors and recipients in eu_loans > are in the EU, without altering the countries and persons tables? One way to do this would be to add countries to the eu_loans table so it looks like this: create

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread CR Lender
On 2013-04-26 12:17, D'Arcy J.M. Cain wrote: > On Fri, 26 Apr 2013 11:01:28 +0200 > CR Lender wrote: >> create table countries ( >> codechar(2) not null primary key, > > Isn't this redundant? Primary keys are always NOT NULL. Yes, I forgot to remove the NOT NULL when I

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread D'Arcy J.M. Cain
On Fri, 26 Apr 2013 11:01:28 +0200 CR Lender wrote: > I have two tables with countries and persons living in those > countries: > > create table countries ( > codechar(2) not null primary key, Isn't this redundant? Primary keys are always NOT NULL. > Enter a third table

Re: [GENERAL] Checking for changes in other tables

2013-04-26 Thread Misa Simic
two triggers?. one on eu_loans... and one on persons (if valid eu_loan - cant move...) 2013/4/26 CR Lender > I have two tables with countries and persons living in those countries: > > create table countries ( > codechar(2) not null primary key, > eu bo

[GENERAL] Checking for changes in other tables

2013-04-26 Thread CR Lender
I have two tables with countries and persons living in those countries: create table countries ( codechar(2) not null primary key, eu boolean not null ); insert into countries values ('AR', false), ('BE', true), ('CH', f