On this page

How do I…

Short answers to everyday tasks, each with what you will accomplish, the commands to type, an example you can reproduce and what to watch out for. Every recipe links to the commands it uses, and each command page links back.

Looking for a message you just got? See Troubleshooting. Looking for one command's exact syntax? See the command reference or the cheat sheet.

About the examples

Every example runs on WORLD, the sample database included in BroadSQL: countries, cities, languages, currencies and regions, in an H2 database opened with CONNECT WORLD; (see Getting started). You can reproduce each one on your own installation, with the same tables, the same columns and the same values.

TableOne row perMain columns
COUNTRYcountry (254 rows)CODE (three letters, the key), NAME, CONTINENT, REGION, POPULATION, CURRENCY_CODE, LAST_UPDATE
CITYcity (4081 rows)ID (the key), NAME, COUNTRYCODE, DISTRICT, POPULATION
COUNTRYLANGUAGElanguage of a country (986 rows)COUNTRYCODE and LANGUAGE (the key), ISOFFICIAL (T or F), PERCENTAGE
CURRENCYcurrency (166 rows)CODE (the key), NAME
REGIONadministrative region (4410 rows)CODE (the key), COUNTRY_CODE2, NAME

A few recipes compare environments. They use three connections that do not exist by default: WORLD-IN (integration) and WORLD-QA (quality assurance), two copies of the sample, and WORLD itself, playing the production database. Set up QA and production copies of WORLD creates them in a few minutes; each of those recipes also says what you can do with WORLD alone.

When an example writes data, it writes into a table, a file or a database you create for the purpose, or into a practice copy of the sample, and it says how to remove or undo what it changed. One recipe, Verify that a data fix changed only the intended rows, changes rows of WORLD itself on the practice set, and puts them back exactly at the end. The sample is ordinary data: to get the original back at any time, replace samples/WorldDB.mv.db with the file of the BroadSQL download while BroadSQL is closed.

Investigate a database

Map a database you do not know, check what depends on a table, watch a value change, find the data that is wrong.

Use lists of values in a query

Values from the clipboard or a colleague's spreadsheet, without retyping them.

Query and compare across environments

Practice copies of WORLD, the same check in QA and in production, the same table in two databases, a smoke check after each deployment.

Export and share results

Files, spreadsheets and local databases, with one command written the same way every time.

Load data and keep copies in sync

From a CSV file into a table, and from a remote table into a local copy.

Automate with Scripts

Save a query once with checked parameters, find it again, make a report Script stop at the first failure.

Keep a record

Work a ticket from the first ID to the answer, and show that a data fix changed only what it should.

Not here?

Found something wrong or unclear on this page? , with the page address.