Which of the following claims about SQL queries is TRUE?
P: Even if there is no GROUP BY clause in a SQL query, it can have a HAVING clause.
Q: If a SQL query has a GROUP BY clause, it can only have a HAVING clause.
R: The SELECT clause must include all attributes used in the GROUP BY clause.
S: The SELECT clause does not have to include all of the attributes used in the GROUP BY clause.
Question reference:
https://www.interviewbit.com/sql-query-interview-questions/
I was shocked to find that the reporting SQL I was asked to take a look at in a SQL Server 2K5 environment contained 4 to 5 levels of the subquery, distinct clauses, unions, and NoLock hints. These hints were necessary due to the SQL taking so long that it was blocking standard processing. All of these elements were present in the same set!
I have been mistakenly labeled as an expert in SQL and now I have been asked to create a test to evaluate a candidate's ability to optimize SQL. Does anyone have any resources or suggestions that I could use to assess these interviewees?