Pergunta de entrevista da empresa Union Bank

Write a SQL query to find data above the average of a column.

Respostas da entrevista

Sigiloso

2 de mai. de 2018

This was i guess their senior developer, Though i wrote the query in a different way, the interviewer wanted me write specific syntax using avg() function. I could n't recall avg() function and wrote the query in a different way but he continued to ask me to use that specific function. I told him i don't rem the syntax though i know we have avg() function in sql but he was not ready to listen. i don't understand such people, do you really need syntax?? i mean cumon..... give me a break man... you need the result and my query is giving you that. Though the manager was nice and help me to solve a puzzle with me.

Sigiloso

16 de jul. de 2018

SELECT * FROM Products WHERE Price > (SELECT AVG(Price) FROM Products);

Sigiloso

16 de jul. de 2018

SELECT * FROM Products WHERE Price >(SELECT AVG(Price) FROM Products);