Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SELECT VALUES in Teradata

Tags:

sql

teradata

I know that it's possible in other SQL flavors (T-SQL) to "select" provided data without a table. Like:

SELECT *
FROM (VALUES (1,2), (3,4)) tbl

How can I do this using Teradata?

like image 515
Peter Smit Avatar asked Nov 28 '17 13:11

Peter Smit


People also ask

How do I SELECT a specific value in SQL?

To select rows using selection symbols for character or graphic data, use the LIKE keyword in a WHERE clause, and the underscore and percent sign as selection symbols. You can create multiple row conditions, and use the AND, OR, or IN keywords to connect the conditions.

How do you SELECT a column by value?

Note: Pressing CTRL+SPACEBAR once selects the table column data; pressing CTRL+SPACEBAR twice selects the entire table column.


1 Answers

Teradata has strange syntax for this:

select t.*
from (select * from (select 1 as a, 2 as b) x
      union all
      select * from (select 3 as a, 4 as b) x
     ) t;
like image 171
Gordon Linoff Avatar answered Sep 30 '22 22:09

Gordon Linoff