Is it possible to connect two tables with no PK and FK relations- Teradata

Hi All,

I know its crime to ask this wierd question. I have a crazy question .I have two datasets and both datasets dont have any common columns. Is it possible to link two tables and get the data from two datasets?

Re: Is it possible to connect two tables with no PK and FK relations- Teradata

Hi Krishna,

You can join two tables which have no common key and get all data from two tables. Through Cross join/Product join it is possible. Below query will yield the result. If TABLE_A has 10 records, TABLE_B has 5 records then cross join will give their product 10*5=50 records. Let me know whether you are looking for this only.

SEL * FROM

TABLE_A JOIN TABLE_B

ON 1=1 ;

Tables in 2 different databases/schemes can be joined. But tables in 2 different servers can't be joined.

Re: Is it possible to connect two tables with no PK and FK relations- Teradata

This example would work, although it should be pointed out that it will return all combinations of rows from two tables. If one table has 1000 rows and the other has a million rows, you will get a billion rows in the answer set.

And no, joined tables do not have to be in the same database. The user just needs select permission on both tables.

But a utility is not required to copy a table from one database to another on the same system. Just SQL: Insert ... Select.