SQLPage Quick Intro


Short video

4 minutes - quick installation & code explanation

Long video

39 minutes - every example on this page explained


SQLPage integrates directly with SQL code, in any common RDBMS, to generate web based UIs and APIs populated by SQL query results. No other web frameworks, language ecosystem tools, or software development layers are required for SQL users, so the complexity of building web apps is dramatically reduced. In addition to serving data through UI and web API interfaces, SQLPage can request data from 3rd party APIs, integrate directly with back-end code written in any other programming language, and incorporate new custom UI components built with any web framework. Bootstrap and Tabler (with all its components & 5000+ icons) are built in. Every SQLPage task is accomplished entirely with SQL code. Anyone can quickly learn how to use the 29 lines of code below, and SQLPage takes less than a minute to install.


CODE EXAMPLES (11 Applications, 29 Total Lines Of Code)

Deliver database query results to a web UI, 1 line


SELECT 'list' AS component, 'Items:' AS title; SELECT column AS title FROM table;

Display database query results as a chart, 1 line


SELECT 'chart' AS component, 'Pets' AS title; SELECT pet AS label, val AS value FROM pets;

Deliver markdown code in a list component, 1 line


SELECT 'list' AS component, 'Blog' AS title; SELECT t AS title, d AS description, m AS description_md FROM blog;


See it run   (yes, that entire blog display is delivered by 1 line of code!)

Layout page and menu items, 1 line

SELECT 'shell' AS component, 'Home' AS title, ' ' AS footer, '{"title":"Go","submenu":[{"icon":"car","link":"m.htm"},{"title":"X"}]}' AS menu_item;

Markdown editor, 3 lines


SELECT 'text' AS component, 'Markdown' AS title, 'Enter code:' AS contents;
SELECT 'form' AS component; SELECT 'Code' AS name, 'textarea' AS type, :Code  AS value;
SELECT 'text' AS component, 'Output:' AS title, :Code AS contents_md;


See it run (with sample markdown code)

Complete database application with interactive UI, 4 lines


CREATE TABLE IF NOT EXISTS things (items TEXT NOT NULL);
INSERT INTO things(items) SELECT :Item WHERE :Item IS NOT NULL;
SELECT 'form' AS component, 'Add item:' AS title; SELECT 'Item' AS name;
SELECT 'list' AS component, 'Items:' AS title; SELECT items AS title FROM things;

Full CRUD app with sortable data table UI, 8 lines


CREATE TABLE IF NOT EXISTS t (i INTEGER PRIMARY KEY, a TEXT);
INSERT INTO t (a) SELECT :A WHERE $e IS NULL AND :A IS NOT NULL;
UPDATE t SET a = :A WHERE i = $e AND :A IS NOT NULL;
DELETE FROM t WHERE i = $d;
SELECT "button" AS component; SELECT "?" AS link, "New" AS title;
SELECT "form" AS component; SELECT (SELECT a FROM t WHERE i = $e) AS value, "A" AS name;
SELECT "table" AS component, "" AS markdown, "X" AS markdown, TRUE AS sort;
  SELECT a AS A, i AS I, "[edit](?e="||i||")" AS "", "[x](?d="||i||")" AS X FROM t;

Integrate a 3rd party web API endpoint, 1 line


SELECT "code" AS component; sqlpage.fetch("https://tinyurl.com/y2mhwbtp") AS contents;

Integrate a 3rd party map search API with a map component, 4 lines


SELECT 'form' AS component; SELECT 'Location' AS name;
SET l=COALESCE(:Location, '');
SET x=sqlpage.fetch('https://tinyurl.com/3crabx94?format=json&q='||sqlpage.url_encode($l));
SELECT 'map' AS component; SELECT $x->>0->>'lat' AS latitude, $x->>0->>'lon' AS longitude;

Deliver database query results to a web API endpoint, 1 line


SELECT'json'AS component,JSON_OBJECT('messages',(SELECT JSON_GROUP_ARRAY(JSON_OBJECT('author',author,'message',message))FROM messages))AS contents;

Integrate Python code, 3 lines (+1 line Python)


SELECT 'form' AS component; SELECT 'Text' AS name, 'textarea' AS type, :Text AS value;
SET w=COALESCE(:Text, '');
SELECT 'text' AS component, 'Count: '||sqlpage.exec('python3', 'count.py', $w) AS contents;


Integrate code written in any programming language (the count.py code above is: import sys; print(len(sys.argv[1].split())) ).

See it run


DOWNLOAD, INSTALL, AND HOST


Download releases

Unpack and run the downloaded executable. That's it. See the server running at:

http://localhost:8080

Paste this example code into a plain text file. Save the file as items.sql, in the same folder as the SQLPage executable:


CREATE TABLE IF NOT EXISTS things (items TEXT NOT NULL);
INSERT INTO things(items) SELECT :Item WHERE :Item IS NOT NULL;
SELECT 'form' AS component, 'Add item:' AS title; SELECT 'Item' AS name;
SELECT 'list' AS component, 'Items:' AS title; SELECT items AS title FROM things;


See the code above run on your local machine:

http://localhost:8080/items.sql


MORE EXAMPLE APPS


(source code)   |   contacts_simple   |   (several thousand rows of data, returned FAST)

(source code)   |   contacts   |   (many useful CRUD features)

(source code)   |   map_points_of_interest   |   (CRUD and API integration combined)

(source code)   |   weather   |   (integrating a more complex API request body)

(source code)   |   animated_webcam_list   |   (custom animated component CSS source code)

(source code)   |   iframe   |   (integrate apps written in other technologies)

(source code)   |   message_api   |   (an API written in SQLPage)

(source code)   |   bootstrap_message_table.html   |   (call the SQLPage API with another web technology)

(source code)   |   bootstrap_message_table_iframe   |   (integrate that technology back into a SQLPage app)


TUTORIALS AND DOCUMENTATION


QUICK START - 80+ pages, comprehensive fast paced tutorial (PDF)

The QuickStart is recommended if you already know some SQL or anything else about software development

Tutorial for absolute beginners - 200+ pages, many screen shots (PDF)

The longer beginner tutorial includes detailed explanations of basic concepts, meant for users with no prior software or web development experience

https://learnsqlpage.com/sqlpage_intro.pdf - PDF of this Quick Intro page

https://tinyurl.com/mr3wc7a9 - TinyURL HTTPS address for this Quick Intro page

Code example quick links   |   plain text version

Official docs

Home page

This Quick Intro page was created with SQLPage