Queries Cursors Views
Writing Logic Queries
Dynamic SQL Statements
Retrieving Data Multiple Tables
Multiple Table Retrieval
Alternate Queries Aliases
Inserting Data Transact SQL
SQL Statement Punctuation
Inserting Values from another Table
Updating Values from differentr Table
Indexing Query Strategies
Full Text Searching
Defining Full Text Indexes
Implement Full Text Search
Aggregate Data - Exercise
Creating an aggregate query
Practice creating an aggregate query.
This exercise is worth a total of 30 points. You will receive up to 30 points for accurately creating the aggregate query as described in the instructions.
Consider this to be the data in the Sales table to produce your aggregate query:
Use Transact-SQL to create a query containing an aggregate expression that produces a summary resultset that looks exactly like the following:
Make sure to note the column names returned in the resultset, as you will need to use aliasing. Also note that the JanuarySales column should only contain sales for the month of January.
Hint: To test for a SaleDate column to be in a specific month, use the Month Transact-SQL server function, like this:
This function returns the numeric month of the date specified by
. Therefore, you can use this function to test in the
clause that the value returns 1, for January.
Take your time and think this one through!
Submitting the exercise
Type or paste your Transact-SQL statement into the text box below, then click
to submit them and view a results page.