EXTRACT Function (SQL)

Help Contents

Introduction

The SQL EXTRACT function returns a field from a timestamp or interval.

Syntax

primary-function-trim ::=
  EXTRACT '(' extract-field 'FROM' extract-source ')'

extract-field ::=
  YEAR
  | MONTH
  | DAY
  | HOUR
  | MINUTE
  | SECOND

extract-source ::=
  value-expression

Remarks

The EXTRACT function extracts a field from a timestamp or interval.

The extract-source can be a DATE, TIMESTAMP, or INTERVAL. If the extract-source is an INTERVAL, the extract-field can not be YEAR or MONTH.

If the extract-source is NULL, the EXTRACT function returns NULL.

Further Information

Value Expressions (SQL)

To learn more about SQL scalar value expressions.

Fernhill SCADA Structured Query Language (SQL)

To learn more about the SQL features in Fernhill SCADA.

Glossary

For the meaning of terms used in Fernhill SCADA.