Skip to content
Edition NigeriaGlobal
Country

You are in the Nigeria edition. Type your country to switch.

Set up your profile

AI for data analysis: spreadsheets and BI · Lesson 5 of 9

Natural-language questions and SQL

Many data tools now let you ask questions in plain words and turn them into SQL. This lesson shows how to describe tables precisely, read a generated query before trusting it, spot joins that double-count and check results with row counts and totals.

Intermediate11 min read5 steps

This lesson is complete in writing. A video for it is on its way.

What you will learn

  • By the end you can explain what a natural language query and text-to-SQL are, and where each can go wrong.
  • You can describe a set of tables, their keys and links precisely enough for an assistant to write a sensible query.
  • You can read a generated query clause by clause before running it.
  • You can spot a join that double-counts and check results with row counts and a simple total.

Key terms in this lesson

Natural language query
A question put to a data tool in everyday words rather than code, which the tool translates into a query and answers from the data it holds.
SQL
Structured Query Language: the standard language for asking a relational database to select, filter, combine and summarise rows of data.
Text-to-SQL
Turning a question written in plain language into a database query, often with the help of an AI assistant, so the question can be run against stored data.

Step 1 of 5

Asking data questions in plain words

Opening this step…

Step 2 of 5

Describe the tables before you ask

This step opens when you finish the one above.

Step 3 of 5

A join that double-counts

This step opens when you finish the one above.

Step 4 of 5

Read the query clause by clause

This step opens when you finish the one above.

Step 5 of 5

Check the result with counts and totals

This step opens when you finish the one above.

Key takeaways

The key takeaways open when you finish every step.

Lesson quiz

5 questions. You need 85% to pass.

The quiz opens when you finish every step.

Read first

Stockertim Learn is education. It explains how investing works and never recommends buying or selling anything.

Up next

AI at workCharts and BI dashboardsRead nowCharts and BI dashboardsAI at work · Intermediate · 15 minAI at workStatistical sanity checksRead nowStatistical sanity checksAI at work · Intermediate · 15 minAI at workData storytellingRead nowData storytellingAI at work · Intermediate · 15 minAI at workPrivacy and reproducible analysisRead nowPrivacy and reproducible analysisAI at work · Intermediate · 15 minTrading: risk, costs and processPortfolio-level sizing: your tot…Read nowPortfolio-level sizing: your total open riskTrading: risk, costs and process · Advanced · 15 minBasicsshare (or stock)Read nowWhat is a share (or stock)?Basics · Beginner · 5 minCreative & media productionDigital, social and search adver…Read nowDigital, social and search advertising formatsCreative & media production · Intermediate · 5 minCreative & media productionThe creative concept and the cam…Read nowThe creative concept and the campaign platformCreative & media production · Intermediate · 5 minAccounting & financeYear-end adjustments: accruals, …Read nowYear-end adjustments: accruals, prepayments, depreciation and bad debtsAccounting & finance · Beginner · 15 minTrading: risk, costs and processRisk per trade and position sizeRead nowRisk per trade and position sizeTrading: risk, costs and process · Intermediate · 15 minFinancial crimeShell companies, nominee directo…Read nowShell companies, nominee directors and hidden ownershipFinancial crime · Intermediate · 15 minAI at workPivot tables and summariesRead nowPivot tables and summariesAI at work · Intermediate · 15 min
English