Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

  • The cover of the SQL Queries and Scripts Collection by MySmartCoPilot: the title, 'Tested on the database versions listed' with PostgreSQL 18.6, MySQL 8.4.11, SQLite 3.51.0 and 3.53.1 and DuckDB 1.5.6; recipe 04-12 and its result, 0 customers with NOT IN and 744 with NOT EXISTS; the checker's summary on each engine (102 passed, 10 ran, 0 failed); four counts and the twelve chapters.
  • A page of the guide, from chapter 6, Analytics recipes: recipe 06-04, ABC (Pareto) classes of products, with its proof strip (the same 3 rows on all four engines), what it does, when to use it, what to change, the watch-out, the PostgreSQL script, how the other engines differ and its result grid (abc_class, products, revenue, pct_of_revenue); above it, the end of recipe 06-03.
  • The sample database diagram: 17 tables as boxes with their row counts and columns marked PK or FK, and arrows from each foreign key to its key: orders, order lines and payments in the middle; customers with their credit, subscriptions and web events on the left; categories, products, prices, gift-set parts and stock on the right; staff, closures and the import batch below.

SQL Queries and Scripts Collection

112 SQL recipes for PostgreSQL, MySQL, SQLite and DuckDB. Tested on the database versions listed.

  • From MySmartCoPilot
  • ZIP
  • PDF
  • Text
  • 581 files
  • 118 pages

Copy SQL that already works on your engine: 112 recipes for reports, window functions, dates, joins, analytics, trees, cleaning and safe changes, each run on four engines.

Price ₹99 / $2.99 One-time payment, any tax included

Download straight after paying. Yours to keep.

What’s inside

  • 112 SQL recipes in 12 chaptersselect, filter and sort; group and summarise; window functions; joins and set logic; dates and calendars; analytics; hierarchies and trees; data quality and cleaning; changing data safely; schema, constraints and JSON; inspecting and maintaining a database; making queries faster
  • 448 ready-to-run script filesone file per recipe for each of PostgreSQL, MySQL, SQLite and DuckDB, each starting with what it does, when to use it, what to change, the trap to watch for and how the engines differ
  • A sample database to run them onan invented online shop in 17 tables (800 customers, 110 products, 4,911 orders, payments, subscriptions, web events, staff and an import full of mistakes), as SQL for each engine, as CSV and as a ready SQLite file
  • The expected result of 102 recipesas CSV files, the same rows on all four engines
  • A checker you run yourselfruns every script on your own installation and compares each result with the expected one; needs Python 3.9 or later and nothing else to install
  • A dialect cheat sheet of 71 rowsthe differences between the four engines that trip people up, each one a small query run on every engine, with what it really answered
  • The guide: 118 pages (PDF)every recipe with its PostgreSQL script, how the other engines differ and the first rows of its result; the sample database drawn as a diagram, the checker, troubleshooting, an index of all recipes and the sources
The files you download
FileFormatSize
MySmartCoPilot-SQL-Scripts-v1.0.zipZIP2.3 MB
MySmartCoPilot-SQL-Scripts-Guide-v1.0.pdfPDF3.4 MB
MySmartCoPilot-SQL-Scripts-Licence-v1.0.txtText2 KB
MySmartCoPilot-SQL-Scripts-Changelog-v1.0.txtText867 bytes

Works with

AppVersionsChecked
PostgreSQL 18.6
Every script run with psql 18.6 on a freshly loaded sample: 102 of 102 results match the expected files, and all 10 catalogue scripts run
Tested
MySQL 8.4.11
Every script run with the mysql 8.4.11 client: 102 of 102 results match, all 10 catalogue scripts run
Tested
SQLite 3.51.0 and 3.53.1
Every script run with the sqlite3 3.51.0 shell and with Python's sqlite3 library (SQLite 3.53.1): 102 of 102 results match on both
Tested
DuckDB 1.5.6
Every script run with the duckdb 1.5.6 shell: 102 of 102 results match, all 10 catalogue scripts run
Tested
Python, for the checker 3.9 or later
Run from the downloaded ZIP with Python 3.9.6 and 3.13.16; standard library only
Tested
PDF readers any PDF reader on a computer, tablet or phone
Tagged PDF/UA-1 with bookmarks for every recipe and internal links
Made for

“Tested” means we opened and checked the file in that app and kept the record. “Made for” means it follows that app’s documented format. No DRM: the file is yours to keep.

Try a sample

  • The cover of the SQL Queries and Scripts Collection by MySmartCoPilot: the title, 'Tested on the database versions listed' with PostgreSQL 18.6, MySQL 8.4.11, SQLite 3.51.0 and 3.53.1 and DuckDB 1.5.6; recipe 04-12 and its result, 0 customers with NOT IN and 744 with NOT EXISTS; the checker's summary on each engine (102 passed, 10 ran, 0 failed); four counts and the twelve chapters.
  • A page of the guide, from chapter 6, Analytics recipes: recipe 06-04, ABC (Pareto) classes of products, with its proof strip (the same 3 rows on all four engines), what it does, when to use it, what to change, the watch-out, the PostgreSQL script, how the other engines differ and its result grid (abc_class, products, revenue, pct_of_revenue); above it, the end of recipe 06-03.
  • The sample database diagram: 17 tables as boxes with their row counts and columns marked PK or FK, and arrows from each foreign key to its key: orders, order lines and payments in the middle; customers with their credit, subscriptions and web events on the left; categories, products, prices, gift-set parts and stock on the right; staff, closures and the import batch below.
  • The first page of the dialect cheat sheet: tables with a column each for PostgreSQL, MySQL, SQLite and DuckDB, every row a small query run on all four. Dates and times first (date literals, month starts, day of the week, 31 January plus a month, which SQLite rolls over to 3 March), then text (joining text, MySQL's ||, the length of 'café', case), with notes.
  • The contents as a map: Start here and the sample database; the 112 recipes in 12 chapters, each with its number, its scope in a line, its count of recipes and its page; then the cheat sheet, the checker, troubleshooting, the index of all recipes, sources, licence, credits and support.

5 of the 118 pages shown here.

How it helps

Proven, not just written

Every one of the 448 scripts was run on PostgreSQL 18.6, MySQL 8.4.11, SQLite 3.51.0 and 3.53.1 and DuckDB 1.5.6 against the same sample database. 102 recipes returned the same rows on every engine, checked row by row against the expected result; the other 10 read each engine's own catalogue and were checked to run.

The right SQL for your engine

Each recipe comes as four files, one per engine, so you never adapt an answer written for another database. Where an engine lacks a feature (FULL OUTER JOIN in MySQL, ROLLUP in SQLite, triggers in DuckDB), its file does the same job another way and returns the same rows.

The traps, explained

Each recipe says what to change and what catches people out: NULLs that make NOT IN return nothing, month ends that lose a day, ties that make results change between runs, joins that double totals, MySQL's recursion and text limits.

Check it yourself in a minute

The checker loads the sample into your own database, runs every script and compares each result with the expected file, so you can see what works on your installation before you rely on it.

Licence

Personal licence. Use it for yourself, in your own learning, projects and job, on all your devices.

  • Personal use
  • Lifetime use of this version
  • Free fixes
  • No resale

Lifetime use of the version you download. Fixes of errors in your edition are free from your order page. Read the full licence.

Refunds and your rights

Because the file is ready the moment you pay, we don’t refund a purchase once its download has started, unless the file is faulty or not as described: then we fix it, send you a corrected file or refund you. If you live in the EU, the EEA or the UK, you can withdraw from your purchase until your download starts, and you keep every right the law gives you.

Your legal guarantee: if a file is faulty or not as described, we repair it, replace it or refund you.

Refunds and withdrawal in the Digital Store terms

Delivery and paying

Download straight after paying, on this page and by e-mail. Nothing is shipped. Sold in the countries where a way to pay shows on this page.

You can download your files again from your order page whenever you need them. If we ever stop offering downloads, we’ll e-mail you at least 90 days before so you can save your copy.

  • In rupees: UPI, cards or netbanking on Razorpay’s secure page. MySmartCoPilot sells the file to you.
  • In US dollars: card or wallet with Dodo Payments, which sells the file to you as merchant of record and e-mails your receipt or invoice.
  • In US dollars with PayPal, where it is offered. MySmartCoPilot sells the file to you.

Bought once, separately from passes. How the Digital Store and passes differ.

Questions

Which databases does it work with?

PostgreSQL, MySQL, SQLite and DuckDB. Every script was run on PostgreSQL 18.6, MySQL 8.4.11, SQLite 3.51.0 and 3.53.1 and DuckDB 1.5.6. Other versions were not tested by us; most recipes use features these engines have had for years, and the checker shows in about a minute which recipes work on yours.

Does it work with other databases?

The scripts are written and tested for the four engines named. Much of the SQL is standard and other databases accept parts of it, but we did not test them, so we do not promise it.

What do I need to install?

Only the database you already use and its command-line client. For SQLite there is no server and nothing to load: a ready sample file is included; open it with the sqlite3 shell or any tool that opens SQLite files. The checker needs Python 3.9 or later; on SQLite it runs the scripts through Python's own sqlite3 module.

Can I use the scripts in my job?

Yes. The personal licence lets you run and change the scripts and use the queries you make from them in your own work, including the databases you look after in your job. It does not let you share the collection: a colleague buys their own copy.

Is the sample data real?

No. Every name, figure and address was made up by our own program, and the e-mail addresses use the domains reserved for examples.

What files do I get?

A ZIP with the 448 scripts, the sample database, the expected results and the checker; the 118-page guide as a PDF; the licence; and the changelog.

Versions

  • Version 1.0: First edition: 112 recipes in 12 chapters, 448 script files for four engines, the sample database, 102 expected results, the checker, the 71-row dialect cheat sheet and the 118-page guide.

More files in Developer Kits.

Postgres, PostgreSQL and the Slonik Logo are trademarks or registered trademarks of the PostgreSQL Community Association of Canada, and used with their permission. Oracle, Java, MySQL, and NetSuite are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. DuckDB is a trademark of the DuckDB Foundation. SQLite and Python are trademarks of their owners. MySmartCoPilot is not affiliated with or endorsed by any of them. All other trademarks are the property of their respective owners. MySmartCoPilot is not affiliated with or endorsed by them. All other trademarks are the property of their respective owners.

Buy SQL Queries and Scripts Collection

SQL Queries and Scripts Collection, version 1.0, ZIP, PDF and Text

Price Total , one-time payment

We send your receipt and your order link here, and nothing else.

Pay with

Your legal guarantee: if a file is faulty or not as described, we repair it, replace it or refund you.

By paying you agree to the Digital Store terms and the licence.

Download straight after paying, on this page and by e-mail. Nothing is shipped. Sold in the countries where a way to pay shows on this page. Problems? support@mysmartcopilot.com

Inside SQL Queries and Scripts Collection

MySmartCoPilot makes the files of the Digital Store and sells them itself or through Dodo Payments, the merchant of record. The rest of the Shop compares other stores’ offers, which you buy at the merchant.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.