Loading...
Loading...
Create SQL examples for OceanBase documentation with proper formatting, meaningful names, and separated results. Use when writing or reviewing example sections in OceanBase documentation.
npx skill4agent add amber-moe/oceanbase-doc-skills oceanbase-examplesobclient>obclient [SCHEMA]>obclient [KILL_USER]> SHOW PROCESSLIST;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 sett1t2tg1db1test_tabletemp_dborder_tgproduct_tginventory_tgorder_tableuser_infoproduct_catalogsales_dbcustomer_dbwarehouse_dbordersorder_itemscustomersproductsorder_tgproduct_tgecommerce_dbtransactionsaccountsbalancestransaction_tgaccount_tgbanking_dbwarehousesinventory_itemsstock_movementswarehouse_tginventory_tglogistics_dbobclient [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;obclient [SALES_DB]> CREATE TABLE order_table (
order_id BIGINT PRIMARY KEY,
customer_id BIGINT,
order_date DATE,
total_amount DECIMAL(10,2)
);obclient [SALES_DB]> SELECT * FROM order_table WHERE order_date >= '2024-01-01';+----------+-------------+------------+--------------+
| 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 setobclient [SYS]> CREATE USER admin_user IDENTIFIED BY 'admin123';
obclient [SYS]> GRANT ALTER SYSTEM TO admin_user;obclient [ADMIN_USER]> CREATE TABLEGROUP order_tg;obclient [ADMIN_USER]> CREATE TABLE order_table (
order_id BIGINT PRIMARY KEY,
customer_id BIGINT
) TABLEGROUP = order_tg;obclient [ADMIN_USER]> SHOW TABLEGROUPS;+-----------+------------+
| TableName | TableGroup |
+-----------+------------+
| order_table | order_tg |
+-----------+------------+
1 row in setobclient [USER]> CREATE TABLE invalid_table (
id INT PRIMARY KEY,
name VARCHAR(10)
) PARTITION BY HASH(id) PARTITIONS 0;ERROR 1235 (42000): Invalid partition countobclient>