Left outer Join in MySQL, For SQL Developers

Опубликовано: 27 Февраль 2026
на канале: Open Source Programming
14
0

Take a top-rated and up-to-date MySQL course on our Channel to learn valuable and practical skills. Whether you want the fundamentals, a deep-dive or specialized topics, our Channel got a course on deck. Learn with hands-on projects and gain a competitive edge in your field.

To take full advantage of this free training, we recommend watching all the videos in the playlist in the order.
   • MySQL - SQL Training  


Sample tables with test data, execute them on our mysql database:
create table books (bookid int primary key, book_title varchar(50),booktypeid int, authorid int, price int)

create table authors (authorid int primary key, authordetails varchar(50));

create table booktype (booktypeid int primary key, booktype varchar(50));

create table booksales (saleid int primary key, customerid int,bookid int, saleamount int);

insert into authors (authorid, authordetails) values (1,'Author1');
insert into authors (authorid, authordetails) values (2,'Author2');
insert into authors (authorid, authordetails) values (3,'Author3');
insert into authors (authorid, authordetails) values (4,'Author4');
insert into authors (authorid, authordetails) values (5,'Author5');
insert into authors (authorid, authordetails) values (6,'Author6');
insert into authors (authorid, authordetails) values (7,'Author7');
insert into authors (authorid, authordetails) values (8,'Author8');
insert into authors (authorid, authordetails) values (9,'Author9');

insert into booktype (booktypeid, booktype) values (1,'Graphic Novels');
insert into booktype (booktypeid, booktype) values (2,'Horror');
insert into booktype (booktypeid, booktype) values (3,'Mystery & Crime');
insert into booktype (booktypeid, booktype) values (4,'Poetry');
insert into booktype (booktypeid, booktype) values (5,'Romance Books');
insert into booktype (booktypeid, booktype) values (6,'Science Fiction & Fantasy');
insert into booktype (booktypeid, booktype) values (7,'Thrillers');
insert into booktype (booktypeid, booktype) values (8,'Westerns');
insert into booktype (booktypeid, booktype) values (9,'Childrens Books');

insert into books (bookid, book_title, booktypeid, authorid, price) values (1,'book1',5,6,18);
insert into books (bookid, book_title, booktypeid, authorid, price) values (2,'book2',2,1,31);
insert into books (bookid, book_title, booktypeid, authorid, price) values (3,'book3',7,7,15);
insert into books (bookid, book_title, booktypeid, authorid, price) values (4,'book4',4,6,24);
insert into books (bookid, book_title, booktypeid, authorid, price) values (5,'book5',4,3,23);
insert into books (bookid, book_title, booktypeid, authorid, price) values (6,'book6',2,8,27);
insert into books (bookid, book_title, booktypeid, authorid, price) values (7,'book7',1,2,17);
insert into books (bookid, book_title, booktypeid, authorid, price) values (8,'book8',4,2,22);
insert into books (bookid, book_title, booktypeid, authorid, price) values (9,'book9',1,4,32);
insert into books (bookid, book_title, booktypeid, authorid, price) values (10,'book10',8,1,25);
insert into books (bookid, book_title, booktypeid, authorid, price) values (11,'book11',8,,22);
insert into books (bookid, book_title, booktypeid, authorid, price) values (12,'book12',9,3,28);
insert into books (bookid, book_title, booktypeid, authorid, price) values (13,'book13',7,4,19);
insert into books (bookid, book_title, booktypeid, authorid, price) values (14,'book14',3,,37);
insert into books (bookid, book_title, booktypeid, authorid, price) values (15,'book15',8,,38);
insert into books (bookid, book_title, booktypeid, authorid, price) values (16,'book16',6,6,24);


insert into booksales (saleid, customerid, bookid, saleamount) values (1,4542,8,44);
insert into booksales (saleid, customerid, bookid, saleamount) values (2,8351,2,45);
insert into booksales (saleid, customerid, bookid, saleamount) values (3,8111,6,38);
insert into booksales (saleid, customerid, bookid, saleamount) values (4,8591,9,56);
insert into booksales (saleid, customerid, bookid, saleamount) values (5,8745,4,41);
insert into booksales (saleid, customerid, bookid, saleamount) values (6,5167,3,55);
insert into booksales (saleid, customerid, bookid, saleamount) values (7,9183,8,56);
insert into booksales (saleid, customerid, bookid, saleamount) values (8,7072,7,38);
insert into booksales (saleid, customerid, bookid, saleamount) values (9,7464,3,60);