Menu
AVG, MAX, MIN, SUM, COUNT – CREATE DATABASE dbName; GO

AVG, MAX, MIN, SUM, COUNT – CREATE DATABASE dbName; GO

These are some of the most common aggregate SQL functions. You saw them in the previous section. You can use these functions to calculate average, maximum, minimum, and total of numeric column values on one or more tables. The COUNT function returns the number of rows that match the SQL statement criteria. Note that after […]

JOIN – CREATE DATABASE dbName; GO

JOIN – CREATE DATABASE dbName; GO

This is a relational structure‐oriented concept that has to do with querying data that exists in two or more tables using a single query. It is possible to use JOINs on NoSQL data, but the nature of nonstructured or semi‐structured means it won’t be a very performant experience. If the JOIN on non‐ or unstructured […]

DBCC SHOW_STATISTICS – CREATE DATABASE dbName; GO

DBCC SHOW_STATISTICS – CREATE DATABASE dbName; GO

This command will display the current optimization statistics for a table or view. Before you can show the statistics, you first need to create them. The following snippet illustrates how this is done. Provide a statistics name, the table (e.g., READING), and the column (e.g., VALUE) for which you want to capture statistics: CREATE STATISTICS […]

DISTINCT – CREATE DATABASE dbName; GO

DISTINCT – CREATE DATABASE dbName; GO

Using the DISTINCT command eliminates duplicate records from your SQL queries. The following query will return all rows from the SESSION table. Assume that the SCENARIO_ID of 1, which is the ClassicalMusic scenario, exists multiple times. In that case all rows are returned, in addition to all other SCENARIO_IDs. SELECT [SCENARIO_ID] FROM [dbo].[SESSION] If you […]