I was given this question and was hoping someone could explain this query? Thank you. J
SQL CONCEPT 1 Please write the result for the following query Table1 name 1.
A 2. B 3. C Table2 name 1. B 2. C 3. D Select t1.name, t2.name FROM Table1 t1 INNER JOIN Table2 t2 ON t1.name = t2.name
mike01
2
The results will be
Table1Name Table2Name
B B
C C
from what I can gather, table 1 has 3 rows in it (A,B,C) and Table 2 has 3 rows as well (B,C,D) By joining on the name, only B and C will match
declare @Table1 table (name char(1))
declare @Table2 table (name char(1))
insert into @Table1 values
('A'),
('B'),
('C')
insert into @Table2 values
('B'),
('C'),
('D')
Select t1.name, t2.name
FROM @Table1 t1
INNER JOIN @Table2 t2
ON t1.name = t2.name