Print all women (customer_pk) and their max income. You need to withdraw those who have a maximum income for all time at least three times more than the minimum for all time. Table table1 looks like this (customer_pk, firstnm, middlenm, lastnm, income) Was the query written correctly?

SELECT customer_pk,maximum FROM ( select customer_pk, min(income) as minimum, max(income) as maximum from table1 where middlenm like '%НА' group by customer_pk )as t WHERE t.maximum >= 3*t. minimum 
  • looks fine in general, run on the test data and see if the result is correct. asking third-party people who do not know what lies in your database and what nuances may be in connection with this is useless (if you don’t give of course the structure of the database describing what and where the data is) - Mike
  • There is too much data and I cannot verify the correctness of the request - Keti Dzebniauri
  • And we are not extrasensories, and we cannot say whether it will work correctly. For example, I do not find it obvious that the condition middlenm like '%НА' will deduce exactly women - Mike

0