- Write your query on the Query Editor
- On the top of the Query Editor, click Save to save the query script to the Script panel.
- To find your saved query script, locate your query script under the Script panel.
Open Script #
When you select and click a query script under the Script panel, the query script will automatically open on the query script on the query tab. You can also click on of a selected query and click Edit Script.
Rename Script #
- Select the script from the Script panel and click .
- Click Rename Script.
- Enter the new script name and click Save.
- To see if the name changed, find the query script with the new name under the Script panel.
Delete Script #
- Select the script from the Script panel and click .
- Click Delete Script.
- Confirm the deletion by clicking Delete.
Writing Query #
Query can be written as follows, for example, virtual data BIG
contains virtual table TRANSACTION_DEPOK
which refers to physical table TRANSACTION_DEPOK
in the database SUPER_RETAIL_DEPOK
from database source MySQL.
Other virtual data can be explained in the following example, virtual data SUPER
contains virtual table PRODUCT
which refers to physical table PRODUCT
in the database SUPER_RETAIL
from database source PostgreSQL.
JOIN
for two virtual tables from two virtual data as follows. --Total Product Sales per Month in Depok
SELECT td.transaction_date,
td.branch,
p.product_line,
SUM(td.total) AS total_sales
FROM BIG.TRANSACTION_DEPOK as td
JOIN SUPER.PRODUCT as p
ON td.id_product_line = p.id
GROUP BY td.transaction_date, td.branch, p.product_line
ORDER BY td.transaction_date ASC;
Execute Query #
Each OneSQL query is separated by a blank line, users who have several queries can execute a query by selecting the query in 1 paragraph and hovering the cursor on the query destination paragraph. To query your written query script, click EXECUTE button.
The source data that has been queried will be displayed in the Preview Result. By default, Preview Result shall display 100 data on the first page.
Export Query Result #
To download data from the query results, click Export All Data, and your data will be downloaded in the form of CSV.
You may also save the query result as virtual view.