0
Name      Gender     School        Position     Salary
-----------------------------------------------------------
Alex      Male       Computing     Lecturer      $80,000
Bob       Male       Mathematics   Lecturer      $60,000
Carol     Female     Mathematics   Lecturer     $100,000
Diana     Female     Computing     Lecturer      $60,000
Ewen      Male       Physics       Lecturer      $72,000
Fran      Female     Physics       Lecturer      $88,000
Gary      Male       Computing     Administrator $40,000
Humphry   Male       Mathematics   Lecturer      $72,000
Ivana     Female     Computing     Tutor         $12,000
Je        Male       Physics       Administrator $80,000
Kim       Female     Mathematics   Lecturer     $100,000
Lex       Male       Computing     Tutor         $12,000
Morris    Male       Engineering   Tutor         $15,000    

Assume you only have a statistical interface, so only aggregate queries will be successful. You know Diana is a female Computing Lecturer. The questions below explore how we might determine her salary using inference, in the presence of various query size restrictions.

Suppose that there is a lower and upper query size limit that satisfies k jX(C)j N k with k = 2. Show a sequence of queries that could be used to determine Diana's salary.

This is a school question can anyone help me out?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Sjapit
  • 17
  • 3
  • Do you know what is a "query size limit" is meant to indicate? Normally if want to retrieve information from a relational database you write one query, not a sequence of queries. I'm afraid this question is based purely in theory with zero practical application to the real world so it may be difficult to get an answer without more context – Nick.Mc Aug 08 '16 at 04:26
  • Yes but its in the context whereby you have no access to the database and u want to know diana salary. – Sjapit Aug 08 '16 at 04:27
  • looks more like a riddle for puzzle exchange or math site. – Juan Carlos Oropeza Aug 08 '16 at 05:24

1 Answers1

0

One agregated function, with conditional SUM()

 SELECT SUM(CASE WHEN Name = 'Diana' THEN Salary ELSE 0 END) as salary
 FROM YourTable

Now dont know what was all that lower upper query size.

or

SELECT Max(Salary)
FROM YourTable
WHERE School = 'computing'
  AND Gender = 'Female'
  AND Position = 'Lecturer'
Juan Carlos Oropeza
  • 47,252
  • 12
  • 78
  • 118