Teradata SubQueriesThe Teradata SubQuery returns records from one table based on the values from another table. It is a SELECT query within another query. The SELECT query called the inner query is executed first, and the outer query uses the result. Some of its most important features are:
Syntax Following is the generic syntax of Teradata SubQueries. Example Consider the following Salary table of the employees.
The following query identifies the employee Id with the highest salary. The inner SELECT performs the aggregation function to return the maximum NetPay value, and the outer SELECT query uses this value to return the employee record with this value. When this query is executed, it produces the following output. /* Query completed. One row found. 2 columns returned */ /* Total elapsed time was 1 second */ Employee_Id NetPay 1003 83000 Next TopicTeradata Substring |