This skill guides creating OceanBase SQL examples with clear structure, meaningful names, and separate results to improve documentation clarity and realism.
npx playbooks add skill amber-moe/oceanbase-doc-skills --skill oceanbase-examples
This skill provides guidelines for creating SQL examples in OceanBase documentation.
Always prefix with prompt:
obclient> for default promptobclient [SCHEMA]> when schema context is relevantInclude semicolons in executable statements.
Example:
obclient [KILL_USER]> SHOW PROCESSLIST;
Separate from SQL statements:
Example:
obclient [KILL_USER]> SHOW PROCESSLIST;
查询结果如下:
+------------+-----------+----------------------+-----------+---------+------+--------+------------------+
| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |
+------------+-----------+----------------------+-----------+---------+------+--------+------------------+
| 3221487726 | KILL_USER | 100.xx.xxx.xxx:34803 | KILL_USER | Query | 0 | ACTIVE | SHOW PROCESSLIST |
+------------+-----------+----------------------+-----------+---------+------+--------+------------------+
1 row in set
Avoid simple names:
t1, t2, tg1, db1test_table, temp_dbUse business-meaningful names:
order_tg, product_tg, inventory_tgorder_table, user_info, product_catalogsales_db, customer_db, warehouse_dbWhy:
E-commerce:
orders, order_items, customers, productsorder_tg, product_tgecommerce_dbFinancial:
transactions, accounts, balancestransaction_tg, account_tgbanking_dbInventory:
warehouses, inventory_items, stock_movementswarehouse_tg, inventory_tglogistics_dbException: Only include these if they provide meaningful information for understanding the example.
Set up meaningful scenario:
obclient [SYS]> CREATE USER sales_user IDENTIFIED BY 'password123';
obclient [SYS]> GRANT CREATE SESSION TO sales_user;
obclient [SYS]> CREATE DATABASE sales_db;
obclient [SYS]> USE sales_db;
Use meaningful names:
obclient [SALES_DB]> CREATE TABLE order_table (
order_id BIGINT PRIMARY KEY,
customer_id BIGINT,
order_date DATE,
total_amount DECIMAL(10,2)
);
Show the SQL statement:
obclient [SALES_DB]> SELECT * FROM order_table WHERE order_date >= '2024-01-01';
Separate code block with descriptive text:
查询结果如下:
+----------+-------------+------------+--------------+
| order_id | customer_id | order_date | total_amount |
+----------+-------------+------------+--------------+
| 101 | 1001 | 2024-01-15 | 1250.00 |
| 102 | 1002 | 2024-01-20 | 850.50 |
+----------+-------------+------------+--------------+
2 rows in set
For complex workflows, break into logical steps:
Step 1: Setup
obclient [SYS]> CREATE USER admin_user IDENTIFIED BY 'admin123';
obclient [SYS]> GRANT ALTER SYSTEM TO admin_user;
Step 2: Create table group
obclient [ADMIN_USER]> CREATE TABLEGROUP order_tg;
Step 3: Create table
obclient [ADMIN_USER]> CREATE TABLE order_table (
order_id BIGINT PRIMARY KEY,
customer_id BIGINT
) TABLEGROUP = order_tg;
Step 4: Verify
obclient [ADMIN_USER]> SHOW TABLEGROUPS;
查询结果如下:
+-----------+------------+
| TableName | TableGroup |
+-----------+------------+
| order_table | order_tg |
+-----------+------------+
1 row in set
When demonstrating error handling:
obclient [USER]> CREATE TABLE invalid_table (
id INT PRIMARY KEY,
name VARCHAR(10)
) PARTITION BY HASH(id) PARTITIONS 0;
错误信息如下:
ERROR 1235 (42000): Invalid partition count
obclient> prefixWeekly roundup of top Claude Code skills, MCP servers, and AI coding tips.