Phase 2: Data Exploration
This section covers how to use a Windows workspace to write SQL queries to explore the data and save data subsets for analysis.
Last updated
This section covers how to use a Windows workspace to write SQL queries to explore the data and save data subsets for analysis.
Last updated
When you are finished working on your workspace for the day, please STOP the workspace to avoid incurring excess cloud costs.
To run a query, click the database in the Object Explorer on the left, and then click the New Query button near the top of the window. That opens a tab where you can enter SQL code. A tutorial introducing SQL can be found at https://www.w3schools.com/sql/sql_intro.asp.
The version of SQL used by Microsoft SQL Server is called T-SQL. Microsoft’s reference guide for T-SQL is at https://learn.microsoft.com/en-us/sql/t-sql/language-reference.
Because you will be working with multiple databases and schemas, it is important to understand how to use “fully qualified” names for tables and views, which have this format:
[DatabaseName].[ViewName].[TableName]
As a basic example, we can view the first 10 rows of the CONCEPT_DIMENSION table like so:
In this example, we are querying the AAOCHIN2023 database, the common data view, and the CONCEPT_DIMENSION table.
For more explanation on how the data is organized and additional example queries, visit the Understanding the OCHIN Data page.
Previously, we simply ran the following query to view the first 10 rows of the CONCEPT_DIMENSION table:
To save the results of this query into our project database, we modify it like so:
This will take the results of the previous query and create a new table called test
inside our project database, in this case S000
.