KSA
KSA

Reputation: 11

How is the query different from traditional SQL language?

I came across a SQL query which looks different from the traditional SQL syntax. Can someone please tell me how is it functionally different from the one which we are used to? And also, whats this SQL known as?

SELECT activity_hour AT TIME ZONE <Parameters.Time Zone> "activity_hour",
      INITCAP(domain_entity) "domain_entity",
      bytes_received,
      bytes_sent,
      bytes_total
FROM recent_subscriber_activity("hour_from$" => <Parameters.Pick a Date>::DATE AT TIME ZONE <Parameters.Time Zone>,                   
                               "hour_to$" => <Parameters.Pick a Date>::DATE AT TIME ZONE <Parameters.Time Zone> + INTERVAL '36 hours,
                               domain_category_grouping$ => TRUE, connection_id$ => <Parameters.connection_id>,domain_category_filter$ => <Parameters.Category>)```

Upvotes: 0

Views: 61

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562348

This is PostgreSQL syntax for some features that are either part of newer revisions of the SQL standard, or else they are proprietary extensions to the SQL standard added by PostgreSQL because they thought they would be useful.

Which SQL features are standard depends on the which year's version of the SQL standard are followed. The SQL standard allows vendors to invent their own extensions to standard SQL.

Some of the parts of the syntax above that you might not recognize are:

All brands of SQL database have their own vendor-specific syntax and enhanced features. It's worthwhile to study the documentation of the brand of SQL database you use, to get accustomed to their features.

Upvotes: 3

Related Questions