This article from InSource provides a guide for querying Historical data in the SQL Management Studio.
- Author: Mataia Ross
- Published: 06/15/2021
- Applies to: Historian
How to query in SQL Management Studio.
- Create a connection to your database.
- Select your database, and click new query.
- Enter the following query.
SELECT pc.Name as CategoryName, p.name as ProductName
FROM [SalesLT].[ProductCategory] pc
JOIN [SalesLT].[Product] p
ON pc.productcategoryid = p.productcategoryid;
- Click Execute
The following are a few tips that will help you to understand SQL. This will also be a cheat sheet when needed to allow you to access information in your data tables.
Here are some of the most common SQL commands and what they do:
SELECT - extracts data from a database
UPDATE - updates data in a database
DELETE - deletes data from a database
INSERT INTO - inserts new data into a database
CREATE DATABASE - creates a new database
ALTER DATABASE - modifies a database
CREATE TABLE - creates a new table
ALTER TABLE - modifies a table
DROP TABLE - deletes a table
CREATE INDEX - creates an index (search key)
DROP INDEX - deletes an index
SELECT is how every query will start. This statement is used to get data from the DB.
FROM gives the location in which information should be gathered.
The data is then returned and stored in a result table, called the result-set.
SELECT column1, column2, ...
WHERE is used the filter the Data
This allows you to choose exact data that matches a specific condition that has been given.
WHERE column_name IS NULL;
This query will only pull data that's value is set to NULL
Here are some interesting things about...