sql-tutor

Teaches SQL concepts and query reasoning for MySQL, PostgreSQL, and SQLite in Japanese.

Updated Jul 4, 2023
One-click install
npx skills add https://github.com/kohdice/dotfiles --skill sql-tutor-kohdice
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sql-tutor
Source: https://github.com/kohdice/dotfiles/tree/main/config/agents/skills/sql-tutor
Command: npx skills add https://github.com/kohdice/dotfiles --skill sql-tutor-kohdice

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Beginners often copy SQL queries without understanding why they work, why the engine rejects them, or why a query silently returns wrong rows. This Skill provides beginner-friendly tutoring that explains the reasoning behind SQL, not just the correct syntax. ## Core Features & Use Cases - Concept-first explanations: Explains joins, NULL three-valued logic, grouping, transactions, and the logical clause execution order with minimal self-contained examples. - Dialect awareness: Resolves whether the user is on MySQL, PostgreSQL, or SQLite and consults a dialect reference for non-portable constructs and exact error message wording. - Error and wrong-result diagnosis: Walks through why an engine raises an error and why dangerous patterns like NOT IN with NULL or WHERE after LEFT JOIN return incorrect rows. - Use Case: A beginner pastes a LEFT JOIN query that unexpectedly drops rows and asks why; the tutor explains that the WHERE clause on the right table turned the join into an inner join, shows the fixed query, and teaches the habit of checking row counts clause by clause. ## Quick Start Ask the tutor to explain why your SQL query returns unexpected rows, in Japanese, mentioning which database engine you use.

Frequently Asked Questions about sql-tutor

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I learn SQL joins as a beginner?▼

This tutor explains INNER JOIN and LEFT JOIN using minimal tables with sample rows, showing which rows pair and which survive. It explains the ON condition as deciding which rows combine, with step-by-step intermediate result diagrams.

Why does my LEFT JOIN return fewer rows than expected?▼

A WHERE condition on the right table after a LEFT JOIN silently turns it into an inner join, because NULL values fail the comparison. Move the condition into the ON clause so it decides which rows pair instead of which rows survive.

Does SQL NULL comparison work with the equals sign?▼

No, comparing with = NULL is never true because NULL means unknown, not empty. Use IS NULL or IS NOT NULL, and COALESCE to define what should happen to unknown values explicitly.

What SQL dialects does this tutor support?▼

It covers MySQL, PostgreSQL, and SQLite. The engine is resolved from what the user names, project evidence like DATABASE_URL or migration files, or portable standard SQL when neither is available.

Can this tutor run queries against my live database?▼

No, live database execution is explicitly out of scope, as are application implementation, refactoring, and code review tasks. It focuses on teaching query logic with self-contained example tables you can paste into any client.

Why does GROUP BY reject my column in PostgreSQL but not SQLite?▼

PostgreSQL and MySQL with ONLY_FULL_GROUP_BY reject non-aggregated columns because the value's source row is unspecified. SQLite accepts it and picks an arbitrary row, so the strictest engine is treated as the teacher.