SQL with multiple tables

Hi All,

I am new to SparkSql. How can i execute the below query and read through the results.
I have 2 tables A and B.

It seems i found the answer, there is a way the query has to be written when there are duplicate columns.
Thank you.