You can join tables from two different schemas by using the syntax "JOIN <SCHEMA>.<TABLE>" to refer to the table in another schema.

For example, suppose you have the following tables, one in the study schema, the other in the lists schema:

study.Demographics

ParticipantIdLanguageGender
PT-101EnglishM
PT-102FrenchF
PT-103GermanF

lists.Languages

LanguageNameTranslatorNameTranslatorPhone
EnglishMonica Payson(206) 234-4321
FrenchEtiene Anson206 898-4444
GermanGundula Prokst(444) 333-5555

The following SQL JOIN creates a table that combines the data from both source tables.

SELECT Demographics.ParticipantId,
Demographics.Language,
Languages.TranslatorName,
Languages.TranslatorPhone,
Demographics.Gender
FROM Demographics
JOIN lists.Languages ON Demographics.Language=Languages.LanguageName

The data returned:

ParticipantIdLanguageTranslatorNameTranslatorPhoneGender
PT-101EnglishMonica Payson(206) 234-4321M
PT-102FrenchEtiene Anson206 898-4444F
PT-103GermanGundula Prokst(444) 333-5555F

Was this content helpful?

Log in or register an account to provide feedback


previousnext
 
expand allcollapse all