SQL code examples · runnable

20 runnable SQL code examples.

Open any SQL example to explore the code and run it online. No setup, no signup.

SQL

Inner, left, right and full outer joins in SQLHow to update one table from another in SQLHow to add a column with a default value in SQLHow to find and delete duplicate rows in SQLHow to combine rows into one string in SQLHow to get only the date from a datetime in SQLHow to insert multiple rows in one SQL statementHow to select the first row in each group in SQLHow to insert rows from a SELECT in SQLHow to write IF/THEN in a SQL SELECTHow to delete rows using a join in SQLUNION vs UNION ALL in SQLHow to group by multiple columns in SQLHow to escape a single quote in SQLHow to limit rows and paginate in SQLHow to get the ID of an inserted row in SQLHow to insert or update if a row exists in SQL (upsert)How to find rows with no match in another table in SQLHow to write a recursive query for tree data in SQLHow to count rows with a condition in SQL
Questions & answers

SQL examples, explained

Can I run these SQL code examples?

Yes. Open any SQL example to edit and run its code on the CompileBytes engine without installing anything.

Is this free? Do I need an account?

Every example is free to read, run, edit, and copy. No account is required.

Can I copy these into my own projects?

Yes. These examples are designed to be copied and adapted to your own code.

Where can I run my own code?

Open the SQL compiler from the main playground catalog, then paste or write any code you want to run.