SQLPage v0.20.3 documentation
If you are completely new to SQLPage, you should start by reading the get started tutorial, which will guide you through the process of creating your first SQLPage application.
Building an application with SQLPage is quite simple. To create a new web page, just create a new SQL file. For each SELECT statement that you write, the data it returns will be analyzed and rendered to the user. The two most important concepts in SQLPage are components and parameters.
- components are small user interface elements that you can use to display your data in a certain way.
- top-level parameters are the properties of these components, allowing you to customize their appearance and behavior.
- row-level parameters constitute the data that you want to display in the components.
To select a component and set its top-level properties, you write the following SQL statement:
SELECT 'component_name' AS component, 'my value' AS top_level_parameter_1;
Then, you can set its row-level parameters by writing a second SELECT statement:
SELECT my_column_1 AS row_level_parameter_1, my_column_2 AS row_level_parameter_2 FROM my_table;
This page documents all the components provided by default in SQLPage and their parameters. Use this as a reference when building your SQL application. If at any point you need help, you can ask for it on the SQLPage forum.
If you know some HTML, you can also easily create your own components for your application.
components
The "text" component
A paragraph of text. The entire component will render as a single paragraph, with each item being rendered as a span of text inside it, the styling of which can be customized using parameters.
Top-level parameters
center
contents
contents_md
html
id
title
width
Row-level parameters
contents
bold
break
code
color
italics
link
size
underline
Example 1
Rendering a simple text paragraph.
select
'text' as component,
'Hello, world ! <3' as contents;
Result
Hello, world ! <3
Example 2
Rendering rich text using markdown
select
'text' as component,
'
# Markdown in SQLPage
## Simple formatting
SQLPage supports only plain text as column values, but markdown allows easily adding **bold**, *italics*, [external links](https://github.com/lovasoa/sqlpage), [links to other pages](/index.sql) and [intra-page links](#my-paragraph).
## Lists
### Unordered lists
* SQLPage is easy
* SQLPage is fun
* SQLPage is free
### Ordered lists
1. SQLPage is fast
2. SQLPage is safe
3. SQLPage is open-source
## Code
```sql
SELECT ''list'' AS component;
SELECT name as title FROM users;
```
## Tables
| SQLPage component | Description | Documentation link |
| --- | --- | --- |
| text | A paragraph of text. | [Documentation](https://sql.ophir.dev/documentation.sql?component=text) |
| list | A list of items. | [Documentation](https://sql.ophir.dev/documentation.sql?component=list) |
| steps | A progress indicator. | [Documentation](https://sql.ophir.dev/documentation.sql?component=steps) |
| form | A series of input fields. | [Documentation](https://sql.ophir.dev/documentation.sql?component=form) |
## Quotes
> Fantastic.
>
> — [HackerNews User](https://news.ycombinator.com/item?id=36194473#36209061) about SQLPage
## Images
![SQLPage logo](https://sql.ophir.dev/favicon.ico)
## Horizontal rules
---
' as contents_md;
Result
Markdown in SQLPage
Simple formatting
SQLPage supports only plain text as column values, but markdown allows easily adding bold, italics, external links, links to other pages and intra-page links.
Lists
Unordered lists
- SQLPage is easy
- SQLPage is fun
- SQLPage is free
Ordered lists
- SQLPage is fast
- SQLPage is safe
- SQLPage is open-source
Code
SELECT 'list' AS component;
SELECT name as title FROM users;
Tables
SQLPage component | Description | Documentation link |
---|---|---|
text | A paragraph of text. | Documentation |
list | A list of items. | Documentation |
steps | A progress indicator. | Documentation |
form | A series of input fields. | Documentation |
Quotes
Fantastic.
— HackerNews User about SQLPage
Images
Horizontal rules
Example 3
Rendering a paragraph with links and styling.
select
'text' as component,
'About SQL' as title;
select
'SQL' as contents,
TRUE as bold,
TRUE as italics;
select
' is a domain-specific language used in programming and designed for managing data held in a ' as contents;
select
'relational database management system' as contents,
'https://en.wikipedia.org/wiki/Relational_database' as link;
select
'. It is particularly useful in handling structured data.' as contents;
Result
About SQL
SQL is a domain-specific language used in programming and designed for managing data held in a relational database management system. It is particularly useful in handling structured data.
Example 4
An intra-page link to a section of the page.
select
'text' as component,
'This is a link to the [next paragraph](#my-paragraph). You can open this link in a new tab and the page will scroll to the paragraph on load.' as contents_md;
select
'text' as component,
'my-paragraph' as id,
'This **is** the next paragraph.' as contents_md;
Result
This is a link to the next paragraph. You can open this link in a new tab and the page will scroll to the paragraph on load.
This is the next paragraph.