Skip to content

SQL query

Smart CSV keeps your file in a small database on your phone, so you can query it with SQL.

Tap Filter in the bottom bar, then Edit as SQL. The editor starts with the query your current conditions amount to, for example:

SELECT *
FROM csv
WHERE ( `continent__D` = 'Europe' )
The SQL editor with a query and Apply · 4 rowsThe SQL editor with a query and Apply · 4 rows
  • The table is called csv.
  • Each column is named after its header, in lower case, with its letter: continent__D is column D, Continent. Columns without a header are just their letter.

Type your query. Pause for a moment and the button updates to Apply · 1,204 rows. If the query has a mistake, the message appears above the editor and Apply waits until you fix it. If nothing matches, it says No rows match.

While typing on a phone, two rows of shortcuts appear above Apply:

  • Columns: tap one to insert its name, quoted the way SQL needs.
  • Keys such as LIKE '%%', AND and ' ', with the cursor left inside the quotes.
-- Trips under $2,000, cheapest first
SELECT * FROM csv
WHERE `budget_(usd)__G` < 2000
ORDER BY `budget_(usd)__G`
-- How many trips per continent
SELECT `continent__D`, COUNT(*) AS trips
FROM csv
GROUP BY `continent__D`
-- Rows where the name contains "new"
SELECT * FROM csv
WHERE `destination__B` LIKE '%new%'

Number and date columns compare by value, so > 100 works on 1,250.00.

  • ⋯ has ready-made queries: show duplicate rows, hide duplicate rows, hide empty rows. Picking one replaces the editor’s text, and Undo brings the old query back.
  • The history button lists your past queries. Tap one to load it.
  • ← goes back to the condition builder. A query can’t be turned back into conditions, so it is discarded (you’re asked first if you changed it).
  • ✕, swiping the panel down or pressing back only closes the panel. Your query is still there next time.

The free version includes a number of free SQL queries; Edit as SQL says how many are left. Checking the row count while you type doesn’t use one up. Pro has no limit.