Table: deputy_prime_ministers_of
Columns: deputy_prime_minister
took_office
left_office
prime_minister
term
party

Question: What year did deputy prime minister Mariano Rajoy Brey take office?
SQL: SELECT SUM("took_office") FROM deputy_prime_ministers_of WHERE "deputy_prime_minister" = 'mariano rajoy brey'

Question: Which deputy prime minister left office in 2004 and was in the 7th legislature?
SQL: SELECT "deputy_prime_minister" FROM deputy_prime_ministers_of WHERE "term" = '7th legislature' AND "left_office" = '2004'

Question: Which deputy prime minister left office in 1981?
SQL: SELECT "deputy_prime_minister" FROM deputy_prime_ministers_of WHERE "left_office" = '1981'