Skip to main content

Using query templates

A query template creates a graphical interface that simplifies running a query with different parameters. This allows an end-user to easily change the values that a query uses without needing to access or understand the underlying SQL or SPARQL code.

As an example, let us take a look at the Data Professional Salary Survey and examine the most popular databases from that survey in 2018. To do that, you could use the following SQL query.

Screen_Shot_2019-07-18_at_3.38.20_PM.png

For those with a bit of SQL knowledge, modifying this query to get the results for the year 2017 is trivial. One would just need to change the year value from 2018 to 2017. But when a query involves JOINs, UNIONs, nested queries, and aliases, the number of lines in the query could go from 5 lines to 50 or more and finding the desired value buried in the query becomes far more challenging.

Creating a query template makes it easy for end users to access the information without worrying about editing a SQL or SPARQL query.

query-template-02.png