SELECT Statement (SQL)

Help Contents

Introduction

The SQL SELECT statement retrieves data from a table in the Fernhill SCADA database. The format of the SELECT statement is:

select-statement ::=
  SELECT [ ALL | DISTINCT ] select-list
  table-expression

Remarks

The SELECT Statement can be used on any table in the Fernhill SCADA database.

Examples

  1. Display all Analog Data Point Tags:
    SELECT FullName, Value, Units, DataSource
    FROM TagDataPointAnalog
  2. Display all Analog Data Point Tags with units in Amps:
    SELECT FullName, Value, DataSource
    FROM TagDataPointAnalog
    WHERE Units='Amps'
  3. Display all Digital Data Point Tags:
    SELECT FullName, StateDesc, DataSource
    FROM TagDataPointDigital
  4. Display statistics on the number of each tag type in the Fernhill SCADA database:
    SELECT TypeLabel,COUNT(*) AS "Count"
    FROM TagCore
    GROUP BY TypeLabel
  5. As above but ordered by count:
    SELECT TypeLabel,COUNT(*) AS "Count"
    FROM TagCore
    GROUP BY TypeLabel
    ORDER BY "Count" DESC
  6. Display statistics on the number of alarms in each state:
    SELECT StateAsText,COUNT(*) AS "Count"
    FROM AlarmEvent.Alarms
    GROUP BY StateAsText

Further Information

Fernhill SCADA .NET Framework Data Provider

To learn about the .NET Framework Data Provider for Fernhill SCADA (FernhillSoftware.Data.FernhillScadaClient).

ODBC driver

To learn about the ODBC driver in Fernhill SCADA.

SQL Test Tool

To learn about the SQL Test Tool.

Glossary

For the meaning of terms used in Fernhill SCADA.