sql

sql is a skill for Claude Code, Codex from miles990/claude-software-skills. It costs 9 tokens per session (3,315 once invoked), scanned A, original, MIT.

A guide to SQL, the language used to query and manage data in relational databases. It covers filtering, sorting, changing data, and designing database structures.

In plain words
What is it for?
Use it to retrieve records, filter results, update data, handle missing values, and plan database designs.
Why use it?
It helps you write clearer database queries and avoid common mistakes when handling stored data.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/miles990/claude-software-skills/sql
Any agent
npx skills add miles990/claude-software-skills --skill sql
Clone the repo
git clone --depth 1 https://github.com/miles990/claude-software-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql

README.md
[![agentmods](https://agentmods.dev/badge/skills/miles990/claude-software-skills/sql.svg)](https://agentmods.dev/skills/miles990/claude-software-skills/sql)
Your own site
<a href="https://agentmods.dev/skills/miles990/claude-software-skills/sql"><img src="https://agentmods.dev/badge/skills/miles990/claude-software-skills/sql.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,315 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.03315
Opus 5 $0.00005 $0.01657
Sonnet 5 $0.00002 $0.00663
Haiku 4.5 $0.00001 $0.00331

Measured 3d ago against content hash 27be31cee806, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sql scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

programming-languages/sql/SKILL.md · 586 lines

How it starts

The opening of the file, as written. The whole thing — 586 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SQL

Overview

SQL patterns for querying, data manipulation, and database design.


Query Fundamentals

Basic Queries

-- SELECT with filtering
SELECT
    id,
    email,
    name,
    created_at
FROM users
WHERE active = true
  AND created_at >= '2024-01-01'
ORDER BY created_at DESC
LIMIT 10 OFFSET 0;

-- Multiple conditions
SELECT *
FROM orders
WHERE status IN ('pending', 'processing')
  AND total_amount > 100
  AND (priority = 'high' OR customer_type = 'premium');

-- LIKE and pattern matching
SELECT *
FROM products
WHERE name LIKE '%widget%'          -- Contains 'widget'
   OR name LIKE 'Premium%'          -- Starts with 'Premium'
   OR sku SIMILAR TO '[A-Z]{3}-[0-9]{4}';  -- Regex pattern (PostgreSQL)

-- NULL handling
SELECT
    id,
    COALESCE(nickname, name, 'Anonymous') AS display_name,
    NULLIF(discount, 0) AS discount_or_null
FROM users
WHERE deleted_at IS NULL;

-- CASE expressions
SELECT
    id,
    name,
    CASE
        WHEN total >= 1000 THEN 'Gold'
        WHEN total >= 500 THEN 'Silver'
        WHEN total >= 100 THEN 'Bronze'
        ELSE 'Standard'
    END AS tier,
    CASE status
        WHEN 'active' THEN 1
        WHEN 'pending' THEN 2
        ELSE 3
    END AS sort_order
FROM customers
ORDER BY sort_order;

-- Distinct and counting
SELECT DISTINCT category
FROM products;

SELECT
    category,
    COUNT(*) AS product_count,
    COUNT(DISTINCT brand) AS brand_count
FROM products
GROUP BY category;

Joins

-- INNER JOIN (only matching rows)
SELECT
    o.id AS order_id,
    o.total_amount,
    u.name AS customer_name,
    u.email
FROM orders o
INNER JOIN users u ON o.user_id = u.id
WHERE o.status = 'completed';

-- LEFT JOIN (all from left, matching from right)
SELECT
    u.id,
    u.name,
    COUNT(o.id) AS order_count,
    COALESCE(SUM(o.total_amount), 0) AS total_spent
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
GROUP BY u.id, u.name;

-- Multiple joins
SELECT
    o.id AS order_id,
    u.name AS customer_name,
    p.name AS product_name,
    oi.quantity,
    oi.unit_price
FROM orders o
JOIN users u ON o.user_id = u.id
JOIN order_items oi ON o.id = oi.order_id
JOIN products p ON oi.product_id = p.id
WHERE o.created_at >= CURRENT_DATE - INTERVAL '30 days';

-- Self join
SELECT
    e.name AS employee,
    m.name AS manager
FROM employees e
LEFT JOIN employees m ON e.manager_id = m.id;

-- Cross join (cartesian product)
SELECT
    p.name AS product,
    c.name AS color
FROM products p
CROSS JOIN colors c;

Read the full file on GitHub · 586 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 586 lines · 9 tokens per session scan A 27be31cee806

Subscribe to this mod's changes

sql is a skill published in the GitHub repository miles990/claude-software-skills (20 stars, last pushed 7mo ago), licensed MIT. It adds 9 tokens to every session and 3,315 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

database-sql

Design database schemas, write efficient SQL queries, create migrations, and optimize database performance. Use when working with databases, writing queries, or designing data models.

asgarovf/locusai · 35 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

graphjin-env

Use when setting up a training or evaluation loop against a GraphJin agent environment — running the container, reading /health, driving episodes hosted or step-by-step or with your own agent over MCP, splitting train from eval, exporting trajectories, and deciding whether two rewards can be compared.

dosco/graphjin · 61 tokens

graphjin-env-workflows

Use when running GraphJin's own environment and evaluation workflows in this repository — generating a suite, cloning or minting a world, authoring tasks, serving graded episodes, sampling, exporting trajectories, publishing a benchmark run — or when changing code those workflows depend on.

dosco/graphjin · 60 tokens

add-graphjin-database

Use when adding a new GraphJin database, warehouse, or CQL/NoSQL backend; building a simulator because no live service is available; wiring a dialect, discovery, tests, scripts, README/CONFIG/FEATURES, or website database support surfaces.

dosco/graphjin · 60 tokens

Database Schema Reviewer

Reviews database schemas for normalization issues, missing indexes, naming inconsistencies, and scalability risks.

Notysoty/openagentskills · 22 tokens