SQL JOIN [Database]


In this page, I would like to describe basic knowledge for SQL join.

🍄 inner join & outer join

I explain based on the following table structure:

CREATE TABLE sell
( "id" NUMBER,
"selled_at" DATE,
"customer_id" VARCHAR2(4)
);

CREATE TABLE customer
( "id" VARCHAR2(4),
"name" VARCHAR2(255)
);

inner join gets records with records in both:

select * from sell inner join customer on (sell.customer_id = customer.id);

left outer join extracts all records ofleft table and combines the records from right table.

select * from sell left outer join customer on (sell.customer_id = customer.id);

right outer join extracts all records of right table and combines some records from left table.

select * from sell right outer join customer on (sell.customer_id = customer.id);

🗻 Special Thanks

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!