Which of the following statements defines column alias correctly?

In an SQL SELECT statement you can use a column alias to assign a specific name to a column. Normally if you use a scalar expression in an SQL SELECT statement, the column name is blank. The alias feature is useful to set a specific column name. For example:

SELECT ROUND( Value, 4 ) AS "Value"
FROM TagDataPointAnalog

Certain column aliases, beginning with the number sign (#) character, have a special meaning when used with the SQL Test Tool. These column aliases turn on features such as row color, row blink or row menu. The column alias values that have special meaning include:

AliasDescription#RowColorThe column value is converted to an integer, and the value defines the row color#RowBlinkThe column value is converted to a boolean value, and the value defines whether the row blinks or not#RowMenuThe column value is converted to a string, and the value defines the context menu associated with the row

To see examples of how these column alias values are used, browse the standard SQL queries:

  1. From the menu, select File followed by Open Query.
  2. Choose a query to view.
  3. See the corresponding SQL statement in the SQL window.

To use the #RowMenu column alias, you need to construct a column alias using the correct syntax. Two types of row menu are supported:

  • The standard tag menu
  • The standard alarm menu

Standard Tag Menu

The Standard Tag Menu provides access to the features of a tag. The standard tag menu is defined by a string using this syntax:

Tag:full-tag-name [ | menu-options]

Where:

  • full-tag-name is the full name of the tag used to build the menu.
  • menu-options is an optional comma separated list of menu options to include.

For more information on these parameters see Standard Tag Menu Parameters.

To obtain a string in this format use the following SQL expression in a select list:

'Tag:'||FullName AS "#RowMenu"

Note: The || operator concatenates the string 'Tag:' with the full name. This should result in a tag menu string with the correct format.

Standard Alarm Menu

The standard alarm menu provides these options:

  • View Alarm: Displays a dialog showing information about the alarm
  • Acknowledge: Acknowledges the alarm without comment
  • Acknowledge with Comment: Prompts the user for a comment then acknowledges the alarm.

The standard alarm menu is defined by a string using this syntax:

Alarm:source-name,condition-name,active-time,cookie

To obtain a string in this format use the following SQL expression in a select list:

'Alarm:'||SourceName||','||ConditionName||','||Cast(ActiveTime as VARCHAR)||','||Cast(Cookie AS VARCHAR) AS "#RowMenu"

{"ad_unit_id":"App_Resource_Sidebar_Upper","resource":{"id":9296997,"author_id":4142577,"title":"Retrieving Data Using the SQL SELECT Statement","created_at":"2017-06-12T15:54:46Z","updated_at":"2017-06-14T01:58:43Z","sample":false,"description":"List the capabilities of SQL SELECT statements\r\nExecute a basic SELECT statement","alerts_enabled":true,"cached_tag_list":"","deleted_at":null,"hidden":false,"average_rating":null,"demote":false,"private":false,"copyable":true,"score":15,"artificial_base_score":0,"recalculate_score":false,"profane":false,"hide_summary":false,"tag_list":[],"admin_tag_list":[],"study_aid_type":"Quiz","show_path":"/quizzes/9296997","folder_id":8995623,"public_author":{"id":4142577,"profile":{"name":"mmmylaisa","about":null,"avatar_service":"gravatar","locale":"en-US","google_author_link":null,"user_type_id":158,"escaped_name":"Mylaisa McMullen","full_name":"Mylaisa McMullen","badge_classes":""}}},"width":300,"height":250,"rtype":"Quiz","rmode":"canonical","sizes":"[[[0, 0], [[300, 250]]]]","custom":[{"key":"rsubject","value":"Digital Technologies"},{"key":"rlevel","value":"Praxis"},{"key":"env","value":"production"},{"key":"rtype","value":"Quiz"},{"key":"rmode","value":"canonical"},{"key":"sequence","value":1},{"key":"uauth","value":"f"},{"key":"uadmin","value":"f"},{"key":"ulang","value":"en"},{"key":"ucurrency","value":"usd"}]}

{"ad_unit_id":"App_Resource_Sidebar_Lower","resource":{"id":9296997,"author_id":4142577,"title":"Retrieving Data Using the SQL SELECT Statement","created_at":"2017-06-12T15:54:46Z","updated_at":"2017-06-14T01:58:43Z","sample":false,"description":"List the capabilities of SQL SELECT statements\r\nExecute a basic SELECT statement","alerts_enabled":true,"cached_tag_list":"","deleted_at":null,"hidden":false,"average_rating":null,"demote":false,"private":false,"copyable":true,"score":15,"artificial_base_score":0,"recalculate_score":false,"profane":false,"hide_summary":false,"tag_list":[],"admin_tag_list":[],"study_aid_type":"Quiz","show_path":"/quizzes/9296997","folder_id":8995623,"public_author":{"id":4142577,"profile":{"name":"mmmylaisa","about":null,"avatar_service":"gravatar","locale":"en-US","google_author_link":null,"user_type_id":158,"escaped_name":"Mylaisa McMullen","full_name":"Mylaisa McMullen","badge_classes":""}}},"width":300,"height":250,"rtype":"Quiz","rmode":"canonical","sizes":"[[[0, 0], [[300, 250]]]]","custom":[{"key":"rsubject","value":"Digital Technologies"},{"key":"rlevel","value":"Praxis"},{"key":"env","value":"production"},{"key":"rtype","value":"Quiz"},{"key":"rmode","value":"canonical"},{"key":"sequence","value":1},{"key":"uauth","value":"f"},{"key":"uadmin","value":"f"},{"key":"ulang","value":"en"},{"key":"ucurrency","value":"usd"}]}

What is column alias?

A column alias is a temporary, alternate name for a column. Aliases are specified in the SELECT clause to name or rename columns so that the result table is clearer or easier to read. Aliases are often used to name a column that is the result of an arithmetic expression or summary function. An alias is one word only.

Which keyword can be used to define alias for a column?

SQL AS keyword is used to give an alias to table or column names in the queries.

What is true about a column alias is useful with calculations?

Benefits of SQL Aliases Allows you to provide more readable names to the column headers when they're presented in the results. Allows client applications to refer to a calculated field by name where no column name exists. Allows you to reduce code and make your queries more concise.

Can you use column alias in SELECT statement?

Column aliases can be used in the SELECT list of a SQL query in PostgreSQL. Like all objects, aliases will be in lowercase by default. If mixed-case letters or special symbols, or spaces are required, quotes must be used.