Solutions - Who was the string puller?

  1. The tables account and bank_transaction

  2. 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.

  3. Via the column name in the tables person and account.

  4. 203993 and 203987

  5. Use

    select * from account where name 
    like 'Sara%' or name like 'Philip%';
    
  6. 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%');
    
  7. Use

    select sum(amount) from bank_transaction
    where account_number_fk = 203987
    and  date > "2014-10-22" and date < "2014-10-26";
    
  8. 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;
    

Back to Tutorial