Querying only becomes effective if we see the associated information in our query results. This is possible if we can select multiple columns through SQL queries.
Is it possible in Google Sheets? Yes!
This tutorial will tackle how it is done via the QUERY function and its associated SQL in Google Sheets.
When you want to list down multiple columns for each entry but apply a single criterion applied to one column, you simply list down the columns to select then followed by the condition. For our example, we have added a table containing U.S. states’ etymology on one sheet.
What if we want to display the state name column and the language of origin column in a separate sheet, without any criterion to use? We use the following query:
select A, D
With this, we'll have to place it in Google Sheets' QUERY function with the format:
=query([range],"[SQL query]'")
And we get the following result:
The same syntax will work if you add conditions to the query. For example, we wish to filter our initial results by adding the column for the year the name was first attested and by selecting states whose names were first attested before 1800. Our query will now look like this:
select A, C, D where C < 1800
With this, we'll have to place it in Google Sheets' QUERY function with the format:
=query([range],"[SQL query]'")
And our result will look like this:
You would naturally ask whether two or more criteria can be combined in a single query. The answer is yes! You can read more about it here.
Can we change the order the selected columns appear? Absolutely! Just arrange the column list in your preferred order. If we make the following query:
select D, C, A
With this, we'll have to place it in Google Sheets' QUERY function with the format:
=query([range],"[SQL query]'")
The result will look like this:
A complex combination of multiple columns and criteria is needed to get refined search results, but even then, you still have to read the entries one-by-one to get meaningful analysis, to ultimately make great decisions for your business.
I have one suggestion for you to do so without having to do the laborious job of querying large databases: consider trying Lido. With a few clicks on your laptop, you can now access all the relevant metrics without going through the hassle of accessing the SQL databases of your eCommerce platforms and then coding the formulas to process them. Let our platform do it all for you!