Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've recently began learning T-SQL and have found that there are some rules to using single table queries. For instance:


If aggregate and non-aggregate expressions are used together in a SELECT statement, the GROUP BY clause must be used.


The HAVING clause is generally used with GROUP BY


The TOP statement relies on the ORDER BY clause for logical precedence among rows


Data returned when using an ORDER BY clause results in a cursor, whereas a table result is returned when not using the ORDER BY clause

I was curious if anyone else had any tips for learning the relationships among the different DML statements.

Thanks in advance!

share|improve this question

closed as not constructive by Nick Chammas, a_horse_with_no_name, Thomas Stringer, Mark Storey-Smith, Martin Smith Mar 16 '12 at 10:01

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

This question is too broad for the Stack Exchange format. If you narrow it down to a specific aspect of T-SQL we can better help you. – Nick Chammas Mar 15 '12 at 22:10
The resources for deep learning of SQL are discussed here:… – Alex_L Mar 15 '12 at 22:36
Thank you all for your helpful responses. I will continue to read and take more notes. – matrixx333 Mar 15 '12 at 23:44

As @Nick suggested, this question is too broad to have straight forward answer. Are you looking for how to write queries ?? Or you are looking for commonly used best practices for any query ?? Or something else ?? May be for starter you can google around this question, or look at some of the following sites,

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.