2 2 votes In SQL-92 (which is what GATE assumes), which columns are allowed in SELECT and HAVING, when GROUP BY is present or not ? Which columns/attributes can be aggregated or non aggregated in SELECT and HAVING? I can't find good, clear info relating this. Databases rdbms sql databases + – shc 435 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
0 0 votes SELECT and HAVING have different purposes. A better comparison would be between WHERE and HAVING. WHERE is to place a condition to select rows that match the condition. HAVING is used along with GROUP BY only, as its function is to select only those groups that match the given condition. As you know, GROUP BY is used only with an aggregate function. Hope this answers the question. nehanshd answered Jan 20 nehanshd comment Share Follow See all 2 Comments 2 2 Comments reply shc commented Jan 21 reply Follow flag Thanks for your answer, but I wanted to know what possible attributes can be present in SELECT, and HAVING clause in different cases. For example I know that HAVING clause can only contain attributes present in GROUP BY. I want to all such rules for the two clause for the cases when GROUP BY is present or not. Thanks. 0 0 replyShare Amjad. commented Jan 21 i edited by Amjad. Jan 21 reply Follow flag @shc hope this video servers your query : SQL Lecture About GroupBy and it's aggregation 0 0 replyShare Please log in or register to add a comment.