The tables account
and bank_transaction
Via foreign key on bank_transaction
referencing the table account
, both have a primary key and connection to table name via the column name
without foreign constraint.
Via the column name
in the tables person
and account
.
203993 and 203987
Use
select * from account where name like 'Sara%' or name like 'Philip%';
Use
select sum(amount) from bank_transaction where account_number_fk = 203987;
and
select sum(amount) from bank_transaction where account_number_fk = (select account_number_pk from account where name like 'Sara%');
Use
select sum(amount) from bank_transaction where account_number_fk = 203987 and date > "2014-10-22" and date < "2014-10-26";
Use
select account_number_fk, sum(amount) from bank_transaction where date > "2014-10-22";
and
select account_number_fk, sum(amount) from bank_transaction where date > "2014-10-22" and date < "2014-10-26" group by account_number_fk having sum(amount) > 10000;