Table: table_a
id |
---|
1 |
1 |
1 |
4 |
5 |
Table: table_b
id |
---|
1 |
1 |
2 |
3 |
6 |
USE sqlforbi;
CREATE TABLE `table_a` ( `id` int NOT NULL );
CREATE TABLE `table_b` ( `id` int NOT NULL );
insert into table_a values (1);
insert into table_a values (1);
insert into table_a values (1);
insert into table_a values (4);
insert into table_a values (5);
insert into table_b values (1);
insert into table_b values (1);
insert into table_b values (2);
insert into table_b values (3);
insert into table_b values (6);
CREATE TABLE `table_a` ( `id` int NOT NULL );
CREATE TABLE `table_b` ( `id` int NOT NULL );
insert into table_a values (1);
insert into table_a values (1);
insert into table_a values (1);
insert into table_a values (4);
insert into table_a values (5);
insert into table_b values (1);
insert into table_b values (1);
insert into table_b values (2);
insert into table_b values (3);
insert into table_b values (6);
When table_a and table_b are INNER JOINED, how many records will be displayed?
6
When table_a and table_b are LEFT JOINED, how many records will be displayed?
8
What is the result when you perform an INNER JOIN between table_a and table_b?
SELECT * FROM table_a a JOIN table_b b on a.id=b.id;
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
What is the result when you perform a LEFT JOIN between table_a and table_b?
SELECT * FROM table_a a LEFT JOIN table_b b on a.id=b.id;
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
1 | 1 |
4 | Null |
5 | Null |