Create a “Run in LiveSQL” link for quick and easy sharing

In this article, you’ll learn how to create shareable links to LiveSQL scripts. If you’re not familiar with LiveSQL, it’s a developer-friendly sandbox to run, test, and demo Oracle Database features right in your browser.

You can share LiveSQL scripts as hyperlink, by copying the link code and pasting it. Clicking this link will open a script in LiveSQL:

Run in LiveSQL

Or, you can use the link in a button, or really however you choose for your blog, social post, or platform of your choice. You can click this button to open my sample LiveSQL script:

Here’s how to generate your own link:

First, Head to LiveSQL, start coding, and create your own script.

Next, click the Share button in the upper right-hand corner of the SQL worksheet.

Screenshot of a SQL worksheet showing a query to find the highest-paid employee in each department, with a share button highlighted in the top-right corner.

In the sharing dialogue, view your code preview and copy the URL or HTML code to share your script. That’s it!

Code editor interface showing a PL/SQL script to find the highest-paid employee in each department, with a button to run the script in LiveSQL.

For reference purposes, here’s the script I used in my example. Always be wary of running scripts from untrusted sources 😀

-- Find the highest-paid employee in each department
SELECT
  d.department_name,
  e.first_name || ' ' || e.last_name AS top_earner,
  e.salary
FROM
  hr.employees e
  JOIN hr.departments d ON e.department_id = d.department_id
WHERE
  (e.department_id, e.salary) IN (
    SELECT
      department_id,
      MAX(salary)
    FROM
      hr.employees
    GROUP BY
      department_id
  )
ORDER BY
  d.department_name;

Questions? Send me a message or connect on LinkedIn. I’m always happy to chat about Oracle Database or other technical topics.

Leave a Reply

Discover more from andersswanson.dev

Subscribe now to keep reading and get access to the full archive.

Continue reading