List all databases and users in Teradata

Sometimes you may need to check all the available databases in the Teradata server. Teradata provides a couple of different ways to get the information. The easiest way to list all the databases in Teradata using the following query: SELECT … Read more »

Teradata COUNT Function

The COUNT function in Teradata returns the total number of qualified rows in the value expression.  Syntax COUNT ( [TYPE] value_expression ); Here, value_expression – A literal or column expression for which the total count is computed. The expression cannot contain … Read more »

Teradata SUM Function

Teradata SUM function returns the arithmetic sum of value_expression or specific column. Syntax SELECT SUM(DISTINCT/ALL value_expression ) FROM tables WHERE predicates; Here, DISTINCT – DISTINCT is used in the SUM function to eliminates all the duplicates and non-null while calculating … Read more »

Teradata MAX (Maximum) Function

Teradata MAX is used to get the maximum value from the value_expression.  Teradata MAX Syntax The syntax of the Teradata MAX is as follows. MAX/MAXIMUM (DISTINCT/ALL value_expression) Here, DISTINCT – If DISTINCT is used in the MAX function then all … Read more »

Teradata MIN (Minimum) Function

Teradata MIN is used to get the minimum value from the value_expression.  Teradata MIN Syntax The syntax of the Teradata MIN is as follows. MIN/MINIMUM (DISTINCT/ALL value_expression) Here, DISTINCT – If DISTINCT is used in the MIN function then all … Read more »

Teradata AVG (Average) Function

The average function in Teradata returns the arithmetic average of all values in value_expression. This is generally used to calculate the average value from a specified column. Teradata average function syntax The syntax of the Teradata average function is as … Read more »

SQL INSERT Statement

In this tutorial, you will learn how to use the SQL INSERT Statement to insert records in a table with the help of examples. The SQL INSERT statement is used to insert one or more records into a SQL table. … Read more »

List of all dbc tables in Teradata

The below query list all the dbc tables in Teradata. Query to list all the dbc tables in Teradata SELECT DatabaseName, TableName, CreateTimeStamp, LastAlterTimeStamp FROM DBC.TablesV WHERE TableKind = ‘T’ and DatabaseName = ‘DBC’ ORDER BY TableName; Here, DatabaseName – … Read more »

SQL Order By Multiple Columns

In this tutorial, you will learn how to sort the result set on multiple columns using the SQL ORDER BY clause.  Sometimes we may need to sort the result set on more than one column.  Syntax The syntax for sorting … Read more »