Menu
UNION – CREATE DATABASE dbName; GO

UNION – CREATE DATABASE dbName; GO

The UNION command combines the data from two or more tables without adding any additional rows. This is best understood visually, so consider the following SQL statement: SELECT SESSION_ID AS ID, CONVERT(VARCHAR(50),SESSION_DATETIME, 127) AS DATE_SCENARIOFROM [SESSION]UNIONSELECT SCENARIO_ID, SCENARIOFROM SCENARIO The result would be something similar to the following. Notice that the rendered output is a […]

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 […]