Sub queries you can give at four places in main query. Those are SELECT, WHERE, HAVING and in FROM clause. To understand these examples clearly you must listen few tips here.
Audio
Tokenization is the most powerful concept being used as per PCIDSS in credit cards domain to mask card number. There are two methods how tokenization works. The differences explained in audio podcast for Vault based and Vault-less methods.