---
title: "Using SQL-file with Markup"
canonical: "https://support.appfire.com/space/SQL/74318394/Using%20SQL-file%20with%20Markup"
format: markdown
---
> Macro (aura-html)

# Scenario

> Macro (div)
> 
> > Macro (inline-media-image)
> 
>  <span style="color: #999999">Estimated Time: 10</span>**<span style="color: #999999"> min</span>**<span style="color: #999999"> </span>

In this scenario, we will insert the SQL-file Macro on a Confluence page by inserting [Markup](https://confluence.atlassian.com/doc/confluence-wiki-markup-251003035.html) from the menu. Our SQL-file Macro will reference a file containing SQL located within the /script (default) directory of your Confluence server.

## Background

Our scenario will use a [Data Source Profile](https://appfire.atlassian.net/wiki/spaces/SQL/pages/74323164) called "*BookWarehouse*" to query a database table called "BOOKS". The table contains the following columns and rows:

```sql
SQL > select * from books;
+----+----------------------------+---------------------+-------+
| id | title                      | author              | price |
+----+----------------------------+---------------------+-------+
|  1 | The Grapes of Wrath        | John Steinbeck      | 12.99 |
|  2 | Nineteen Eighty-Four       | George Orwell       |  8.99 |
|  3 | The Wind-Up Bird Chronicle | Haruki Murakami     |  7.99 |
|  4 | Don Quixote                | Miguel De Cervantes | 29.99 |
|  5 | Pilgrims Progress          | John Bunyan         | 17.99 |
|  6 | Robinson Crusoe            | Daniel Defoe        | 29.05 |
|  7 | Gullivers Travels          | Jonathan Swift      | 15.98 |
|  8 | Tom Jones                  | Henry Fielding      | 13.59 |
|  9 | Clarissa                   | Samuel Richardson   | 13.59 |
| 10 | Tristram Shandy            | Laurence Sterne     |  7.59 |
+----+----------------------------+---------------------+-------+
```

Our query will be stored within a file called "books.sql" and we will work with our Confluence administrator to place it within the /script (default) directory on our Confluence server. Our query looks like:

```sql
SELECT title as "Title", author as "Author", price as "Retail Price" FROM books WHERE price < 30 ORDER BY title;
```

## Steps

The following steps will demonstrate how to use Markup to insert the SQL-file Macro on a Confluence page.

> Macro (table-plus)
> 
> |  |  |  |
> | --- | --- | --- |
> | ![image](media://4a8aa935-22af-4fef-a6f4-4400bfbd0cf7) | ## Create Confluence page<br>Create a Confluence page that will eventually contain the SQL-file Macro needed to list out your books.<br>1. Create a page named **Classic Books** in a space accessible to the desired audience.
> 2. Click **Save** to save the new page. |  |
> | --- |
> | ![image](media://dcddf7c4-a6d6-473d-860b-c59028762e87) | ## Insert the SQL-file Macro using the Insert Markup Menu<br>Edit the **Classic Books** page and:<br>1. Select Insert Markup from the top menu.
> 2. Type the follwing into the editor window. Note the dataSource name and file name referenced.
> 3. Click Insert to insert your Markup within the page.
> 4. Click **Save **to save your page and view your results.<br>## Alternative:<br>> Macro (nested-table) | **How to insert Markup from the menu**<br>![image](media://406253ff-e0c9-45a4-9acd-19c8013648c0)<br>![image](media://c9015b67-7ef8-43b0-8301-0475d47b4c66) |

## Explore Tutorials

We've prepared a number of tutorials which demonstrate how to use our SQL Macros with the native Chart Macro.

![image](media://5bfd5a8c-00cd-4aa7-bd21-5b6906f4b6af)