Layla

Mastering SQL Joins, With Zero Database Setup

Cover Image for Mastering SQL Joins, With Zero Database Setup

Howdy SQL enthusiast! If you’re diving into SQL and tackling joins—a key concept for combining data from multiple tables— LiveSQL is your free, browser-based playground to make learning a breeze 🔥 It’s built on Oracle Database, which means: no downloads, no installs, just pure SQL practice. In this post, we’ll walk you through using LiveSQL to master joins with hands-on examples to show you exactly how it works. Let’s get started!!

Why Joins Matter

Joins let you pull data from multiple tables based on a shared column—like matching customer orders to customer names. If you’re in a database class or following along an online course, you’re probably seeing joins early on. LiveSQL makes practicing joins (or any other database programming concept) intuitive, with pre-loaded datasets and a clean interface to run queries and see results instantly! 😊


Step 1: Jump into LiveSQL (No Account Needed)

Head to livesql.oracle.com/next and you’re immediately dropped into LiveSQL’s Worksheet, where the magic happens—no signup required to start querying! 🥳

On the left, the Navigator Panel shows pre-loaded tables you can experiment with, like EMP (employees) and DEPT (departments). These are perfect for practicing joins. In the center, the Worksheet is where you’ll write your SQL. Below it, the Query Result Panel shows your output. Here’s the interface:

Step 2: Write Your First Join Query

Let’s try an INNER JOIN to combine employee names from the EMP table with their department names from the DEPT table. The shared column? DEPTNO (department number).

In the Worksheet, type this query:

SELECT e.ENAME, d.DNAME
FROM SCOTT.EMP e
INNER JOIN SCOTT.DEPT d
ON e.DEPTNO = d.DEPTNO;

Hit the Run button (or press Ctrl+Enter). Boom—your results appear in the Query Result Panel, showing employee names alongside their department names:

What’s happening here? The INNER JOIN grabs only the rows where DEPTNO matches in both tables. Notice how LiveSQL’s interface makes it easy to write, run, and check your output without any setup 🥰

Step 3: Experiment with Different Joins

Joins come in flavors like LEFT JOIN, RIGHT JOIN, and FULL JOIN, each handling unmatched rows differently 🔥 Let’s try a LEFT JOIN to include all employees, even if they don’t have a department:

SELECT e.ENAME, d.DNAME
FROM SCOTT.EMP e
LEFT JOIN SCOTT.DEPT d
ON e.DEPTNO = d.DEPTNO;

Run it, and you’ll see all employees, with NULL for any missing department names. LiveSQL’s Query Result Panel clearly displays the output, and you can toggle to the Explain Plan tab to see how the query works under the hood. Here’s the query results:

And here’s how you can check out your query’s Explain plan:

Step 4: Save Your Work (Optional Free Account)

Love your query? Save it as a .sql file to your device via the Worksheet’s Save button, or store it in your browser’s local storage to have for next time you visit LiveSQL.

Want to create your own tables or save queries to your LiveSQL account? Sign up for a free Oracle account in 2 minutes:

  1. Click Sign In (top right).

  2. Hit Create an Account, enter your email/name/password, and verify via email.

  3. Sign in, and you’ll get your own schema to build your own tables and save your work!

With an account, you can also favorite tutorials in LiveSQL’s Library (more on that next).

Step 5: Level Up with LiveSQL’s Library

LiveSQL’s Library tab is packed with tutorials to deepen your joins knowledge. Click Library on the homepage, search for “joins,” and pick a tutorial like “Joining Tables.” Each tutorial walks you through steps with sample queries you can run directly in the Worksheet.

Note*: To create or modify tables in tutorials (e.g., inserting data, dropping tables, etc), you’ll need that free account!* 🤠

Step 6: Break It, Learn It, Ask for Help

LiveSQL’s Worksheet is a safe sandbox—experiment without fear, friends 🫣 try tweaking your join queries (e.g., change INNER to FULL or mess with the ON clause) to see what happens. Stuck? Reach out:

  • DM me on X (@pilatesdev): I’m the LiveSQL product manager and happy to help!

  • Oracle Community: Check the LiveSQL forum for tips from the team.


Your Next Steps

You’ve just used LiveSQL to practice INNER and LEFT JOINs, from writing queries to checking results and exploring tutorials—all without installing a thing. Ready for more? Try these:

  • Test a RIGHT JOIN or FULL JOIN on the EMP and DEPT tables.

  • Explore the Library’s “How Joins Work” tutorial to get an overview of the different join methods in Oracle Database: nested loops, hash joins, and merge joins!

  • Follow me on X for more SQL tips and LiveSQL tricks!

Jump back into livesql.oracle.com and keep on practicing. Happy joining! :-)