Search code examples
sqldatabaseteradatadefault

teradata default database query


If I run the following queries in Teradata:

DATABASE DB1_DEFAULT;

SELECT * FROM TABLE1 T1 INNER JOIN DB2_NOT_DEFAULT.TABLE2 T2 ON T1.ID = T2.ID;

Does this SELECT query by any way make DB2_NOT_DEFAULT the default database, or will DB1_DEFAULT continue to be the default database until I issue a second DATABASE command?


Solution

  • Since you have done DATABASE DB1_DEFAULT; so DB1_DEFAULT will be your default database . But for TABLE2 you specifically mentioned DB2_NOT_DEFAULT, it can fetch data from that. It will not change your default database.