Select "m" from table 1 and return "male" based on table 2

I have two tables here.

Table 1:

|    GENDER    |
|      m       |
|      f       |
|      m       |

      

Table 2:

|    GENDER    |    GENDER_FULL  |
|      m       |       Male      |
|      f       |      Female     |

      

How to run a query to return results below.

|   GENDER_FULL   |
|      Male       |
|     Female      |
|      Male       |

      

Table 1 is my main table.

+3


source to share


3 answers


select t2.gender_full
from table1 t1
join table2 t2 on t1.gender = t2.gender

      



+4


source


select GENDER_FULL from table1 t1,table2 t2
where t1.GENDER=t2.GENDER

      



0


source


SELECT t2.gender_full
FROM table1 t1
JOIN table2 t2 USING(gender)

      

- another solution. It beats the solution ON

because you can reference the column gender

without qualifying the table. This ON

is impossible.

0


source







All Articles