Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize | SQLize | SQLtest

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code. Now embed mode is possible!

A A A
Login    Share code      Blog   FAQ

SQLize Embed Documentation

SQLize Embed is a lightweight, responsive SQL editor and executor that you can embed into any website. It allows your users to run SQL queries against various database engines directly in their browser.

Key Features


Getting Started

1. Include the Script

Add the following script tag to the <head> or before the closing </body> tag of your website:

<script src="https://api.sqlize.online/js/sqlize-embed.js"></script>

2. Add an Editor Container

Create a div element with the data-sqlize-editor attribute. You can specify the database version and the number of visible rows for the editor.

<div data-sqlize-editor 
 data-sql-version="mysql80" 
 code-rows="10">
SELECT * FROM sakila.actor LIMIT 5;
</div>

Configuration Attributes

Attribute Description Default
data-sqlize-editor Required attribute to identify the container as an editor. N/A
data-sql-version The database engine to use (e.g., mysql80, psql17, sqlite3). mysql80
code-rows The fixed number of lines the editor should display. 12
result-rows The fixed number of lines the result block should display. 12
data-read-only Set to true to disable editing. false

Supported Database Versions

Use these values in the data-sql-version attribute:

Value Database Engine
mysql80MySQL 8.0
mysql93MySQL 9.3.0
mariadb123MariaDB 12.3
mariadb118MariaDB 11.8
mariadbMariaDB 10
psql14PostgreSQL 14
psql15PostgreSQL 15
psql16PostgreSQL 16
psql17PostgreSQL 17 + PostGIS
psql18PostgreSQL 18
mssql2017MS SQL Server 2017
mssql2019MS SQL Server 2019
mssql2022MS SQL Server 2022
mssql2025MS SQL Server 2025
sqlite3SQLite 3
oracle21Oracle Database 21c
oracle23Oracle Database 26ai
firebird4Firebird 4.0
firebird5Firebird 5.0
clickhouseClickHouse

Note: Preloaded datasets like mysql80_sakila, mariadb118_openflights, and psql10demo are also available.


Use Cases

Educational Blogs & Tutorials

Perfect for teaching SQL. Provide interactive examples where students can modify queries and see results instantly without installing any software.

Documentation for Database Tools

Include "Try it now" sections in your documentation to demonstrate specific features of a database engine.

Portfolio & Technical Interviewing

Showcase complex SQL queries in your blog or use it as a simple platform for technical assessments.


Pricing Policy

SQLize Embed is distributed on a paid subscription basis.

For a custom quote and to obtain your license key, please contact us at support@sqlize.com.


Examples

PostgreSQL with PostGIS

<div data-sqlize-editor data-sql-version="psql17" code-rows="5">
SELECT postgis_full_version();
</div>

SQLite (Empty Editor)

<div data-sqlize-editor data-sql-version="sqlite3">
-- Type your SQLite query here
</div>

Read-Only Editor

<div data-sqlize-editor data-sql-version="mysql80" data-read-only="true">
-- This code cannot be edited
SELECT 'You can see me, but you can\'t touch me!' as message;
</div>

License

This script utilizes the Ace Editor, which is licensed under the BSD 3-Clause License. By using this script, you agree to the SQLize Embed Terms of Service.

SQLize.online Embedding Example

This page demonstrates how to embed an interactive SQL editor using the sqlize-embed.js script. You can specify the database version using the data-sql-version attribute.

1. MySQL 8.0 Example

-- Create a sample table CREATE TABLE users ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(100), email VARCHAR(100) ); -- Insert some data INSERT INTO users (name, email) VALUES ('Alice', 'alice@example.com'), ('Bob', 'bob@example.com'); -- Query the data SELECT * FROM users;

2. PostgreSQL 15 Example

SELECT version(); CREATE TABLE products ( pid serial PRIMARY KEY, pname text NOT NULL, price numeric CHECK (price > 0) ); INSERT INTO products (pname, price) VALUES ('SQLize Pro', 19.99); SELECT * FROM products;

3. MariaDB 11.8 Example with Vector Type

-- Create a table with a Vector column CREATE TABLE t1 (id INT PRIMARY KEY, v VECTOR(3)); -- Insert vector data using VEC_FromText INSERT INTO t1 VALUES (1, VEC_FromText('[1,2,3]')), (2, VEC_FromText('[4,5,6]')), (3, VEC_FromText('[7,8,9]')); -- Calculate Euclidean distance SELECT id, VEC_ToText(v) as `vector`, VEC_DISTANCE_EUCLIDEAN(v, VEC_FromText('[1,1,1]')) as distance FROM t1 ORDER BY distance;

4. Read-Only Example

This editor is set to data-read-only="true", meaning you can run the query but not modify it.

-- This editor is read-only SELECT 'Hello from a read-only editor!' AS message, NOW() AS execution_time;

5. Custom Result Height Example

This editor uses result-rows="6" to make the result block smaller than the default.

-- Smaller editor and smaller result block SELECT 'Small result block' as note;

How to use:

  1. Include the script: <script src="/js/sqlize-embed.js"></script>
  2. Add a container: <div data-sqlize-editor data-sql-version="mysql80">SELECT ...</div>