Database Management

No DBA needed —
manage your database conversationally

From schema design to advanced queries, performance analysis, and security controls.
A single line of conversation replaces dozens of lines of SQL.

🏗

Schema Design

Create tables, FKs, indexes, and triggers
through conversation

🔍

Advanced Queries

Request JOINs, window functions, and CTEs
through conversation and see the results

🛡

Safety Controls

UPDATE/DROP are auto-detected —
never executed without approval

Execution Scenario D0A — Shopping Mall DB Setup & Operations (Comprehensive)
MariaDB 10.5 · db.example.com:3306 · testshop DB · 15 turns · Executed 2026-07-12
1 Connection & Schema Design T0 ~ T2
U

Connect to the MariaDB testshop database at db.example.com. Port 3306, root account.

wiiiv

Successfully connected to MariaDB (root@db.example.com:3306/testshop)

MariaDB 10.5.29-MariaDB-log — Ready to execute queries and DDL.

U

Design a shopping mall DB. Create 5 tables — categories, customers, products, orders, order_items — with FK relationships.

wiiiv

Prepared to create 5 tables. SqlHazardGuard detected a DDL change:

SqlHazardGuard — HAZARDOUS
CREATE TABLE categories (category_id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(50) NOT NULL, description TEXT)
CREATE: A new object will be created. Proceed?

After approval, 5 tables + FK relationships will be configured.

DDL (CREATE TABLE) also passes through the safety gate. The structure requires confirmation for the act of “creation” itself.
2 Advanced Query Generation T3 ~ T7

A single request through conversation generates DBA-level SQL. Below are the actual queries and results.

U

Get the total purchase amount and order count per customer. JOIN customers, orders, and order_items to show customer name, grade, total orders, total purchases, and average order value.

wiiiv

Executed a 3-table JOIN + GROUP BY aggregation query.

SELECT c.name AS customer_name, c.grade, COUNT(DISTINCT o.order_id) AS total_orders, COALESCE(SUM(oi.line_total), 0) AS total_purchase_amount, COALESCE(ROUND(SUM(oi.line_total) / NULLIF(COUNT(DISTINCT o.order_id), 0), 2), 0) AS avg_order_amount FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id LEFT JOIN order_items oi ON o.order_id = oi.order_id GROUP BY c.customer_id, c.name, c.grade ORDER BY total_purchase_amount DESC;
CustomerGradeOrdersTotal PurchasesAvg. Order Value
임지영VIP92,050,500227,833
김도윤VIP101,918,900191,890
조시우VIP81,866,100233,263
정서연VIP71,816,200259,457
박지우VIP101,789,800178,980

Top 5 of 500 total customers

U

Show only customers whose purchases exceed the overall average. Use a subquery for the overall average and filter with HAVING. Also show each customer's most purchased category.

wiiiv

Retrieved 231 customers exceeding the overall average of ₩612,041. A 5-stage CTE query.

WITH customer_totals AS ( SELECT c.customer_id, c.name, c.grade, COALESCE(SUM(oi.line_total), 0) AS total_purchase_amount FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id LEFT JOIN order_items oi ON o.order_id = oi.order_id GROUP BY c.customer_id, c.name, c.grade ), avg_total AS ( SELECT AVG(total_purchase_amount) AS avg_purchase_amount FROM customer_totals ), category_spend AS ( SELECT c.customer_id, cat.name AS category_name, COALESCE(SUM(oi.line_total), 0) AS category_purchase_amount FROM customers c LEFT JOIN orders o ON c.customer_id = o.customer_id LEFT JOIN order_items oi ON o.order_id = oi.order_id LEFT JOIN products p ON oi.product_id = p.product_id LEFT JOIN categories cat ON p.category_id = cat.category_id GROUP BY c.customer_id, cat.name ), top_category AS ( SELECT customer_id, category_name, ROW_NUMBER() OVER ( PARTITION BY customer_id ORDER BY category_purchase_amount DESC ) AS rn FROM category_spend ) SELECT ct.customer_name, ct.grade, ct.total_purchase_amount, tc.category_name AS top_category_name FROM customer_totals ct CROSS JOIN avg_total a LEFT JOIN top_category tc ON ct.customer_id = tc.customer_id AND tc.rn = 1 HAVING ct.total_purchase_amount > a.avg_purchase_amount ORDER BY ct.total_purchase_amount DESC;
CustomerGradeTotal PurchasesTop Category
임지영VIP2,050,500Books
김도윤VIP1,918,900Sports
조시우VIP1,866,100Furniture
정서연VIP1,816,200Baby & Kids
박지우VIP1,789,800Home & Living

Top 5 of 231 customers exceeding the average (₩612,041)

U

Analyze monthly sales by category. Show sales rank with RANK(), month-over-month change with LAG(), and cumulative sales with SUM() OVER.

wiiiv

Retrieved 129 rows using 3 window functions (RANK, LAG, SUM OVER).

WITH monthly_category_sales AS ( SELECT cat.category_id, cat.name AS category_name, DATE_FORMAT(o.order_date, '%Y-%m') AS sale_month, SUM(oi.line_total) AS monthly_sales FROM orders o JOIN order_items oi ON o.order_id = oi.order_id JOIN products p ON oi.product_id = p.product_id JOIN categories cat ON p.category_id = cat.category_id GROUP BY cat.category_id, cat.name, DATE_FORMAT(o.order_date, '%Y-%m') ) SELECT category_name, sale_month, monthly_sales, RANK() OVER (PARTITION BY sale_month ORDER BY monthly_sales DESC) AS sales_rank, monthly_sales - LAG(monthly_sales) OVER (PARTITION BY category_id ORDER BY sale_month) AS mom_change, SUM(monthly_sales) OVER (PARTITION BY category_id ORDER BY sale_month) AS cumulative_sales FROM monthly_category_sales ORDER BY sale_month, sales_rank;
CategoryMonthSalesRankMoM ChangeCumulative
Sports2025-072,943,90012,943,900
Baby & Kids2025-072,937,40022,937,400
Books2025-072,856,10032,856,100
Sports2025-083,396,0001+452,1006,339,900
Books2025-083,164,5002+308,4006,020,600

10 categories × 13 months = 129 rows (partial view)

U

Create a query showing the top 3 products per category using CTE and ROW_NUMBER(). Don't execute it yet. Just show me the SQL.

wiiiv

Query drafted. Not yet executed.

WITH product_sales AS ( SELECT c.name AS category_name, p.name AS product_name, SUM(oi.line_total) AS total_sales FROM order_items oi JOIN products p ON oi.product_id = p.product_id JOIN categories c ON p.category_id = c.category_id GROUP BY c.name, p.name ), ranked_products AS ( SELECT category_name, product_name, total_sales, ROW_NUMBER() OVER ( PARTITION BY category_name ORDER BY total_sales DESC ) AS sales_rank FROM product_sales ) SELECT category_name, product_name, total_sales, sales_rank FROM ranked_products WHERE sales_rank <= 3 ORDER BY category_name, sales_rank;
U

Execute the query you just wrote.

wiiiv

Execution complete. 10 categories × 3 = 30 rows.

CategoryProductTotal SalesRank
FurnitureClassic Desk 533,050,4001
FurnitureSlim Desk 32,499,0002
FurnitureSlim Desk 432,263,8003
DigitalClassic Mouse 284,642,1001
DigitalLite Mouse 484,158,6002
DigitalMax Mouse 282,689,2003
FoodMini Snack 824,026,4001
FoodSmart Snack 423,515,4002
FoodLite Snack 522,938,5003

9 of 30 rows shown — accurately recalled and executed “the query just written”

The “Don't execute it yet” instruction was respected, and in the next turn, “the query you just wrote” was identified from context and executed. This demonstrates conversational context understanding, not mere command execution.
3 DBA Administration T8 ~ T11
U

Analyze the execution plan of the T5 monthly sales query with EXPLAIN. If there's a full scan, add an index.

wiiiv

Prepared an index after EXPLAIN analysis:

SqlHazardGuard — HAZARDOUS
CREATE INDEX idx_orders_order_date ON orders(order_date)
CREATE: A new object will be created.
U

Enable the slow query log. Set it to record queries taking more than 1 second, and run an intentionally slow query to test.

wiiiv

Slow query log configured. SELECT SLEEP(2) test results:

ItemValue
slow_query_log1 (Active)
long_query_time1.0 sec
Test QuerySELECT SLEEP(2)
Execution Time2004ms
U

Audit all current DB users and their privileges. Determine if any have excessive permissions.

wiiiv
UserHost
root%
mariadb.syslocalhost
mysqllocalhost
rootlocalhost
shopadminlocalhost
shopreaderlocalhost

6 users identified.

4 Safety Controls (SqlHazardGuard) T12 ~ T13

UPDATE, DELETE, DROP, and other data-modifying/destructive commands are automatically detected by SqlHazardGuard. They are never executed without user approval.

U

Update the grade to VIP for customers with total purchases of ₩1,000,000 or more.

wiiiv
SqlHazardGuard — HAZARDOUS
UPDATE customers SET grade = 'VIP' WHERE customer_id IN (SELECT customer_id FROM (SELECT customer_id FROM orders GROUP BY customer_id HAVING SUM(total_amount) >= 1000000) AS vip_customers)
UPDATE: Matching rows will be modified. Estimated impact: 71 rows

Proceed?

U

DROP the order_items, orders, products, customers, and categories tables to clean up.

wiiiv
Blocked — Destructive Operation
DROP TABLE order_items, orders, products, customers, categories
This is a destructive operation that would delete all core tables in the database. DROP/TRUNCATE is blocked by the protection policy.
UPDATE calculates the impact scope (71 rows) before requesting approval. DROP assesses the destruction scale — deleting all tables — and blocks immediately. In both cases, user data is protected.

Safety Control Flow

All SQL commands pass through SqlHazardGuard before execution.

User Request SQL Generation SqlHazardGuard Analysis Risk Assessment Approve / Block Execute
SQL TypeRisk LevelBehavior
SELECTSAFEExecute immediately
CREATE / ALTERHAZARDOUSExecute after approval
INSERTHAZARDOUSExecute after approval
UPDATE / DELETEHAZARDOUSShow impact scope + request approval
DROP / TRUNCATE (full)DESTRUCTIVEBlock immediately
15
Total Turns
5
Advanced SQL Turns
3
Gate Triggers
500
Customer Records

SQL Techniques Generated from a Single Request

TurnRequestGenerated SQL Technique
T3Per-customer purchases3-way LEFT JOIN + GROUP BY + SUM/COUNT/AVG
T4Above average + top category5-stage CTE + HAVING + ROW_NUMBER + CROSS JOIN
T5Monthly sales trendsRANK() + LAG() + SUM() OVER (3 window functions)
T6Top 3 per categoryCTE + ROW_NUMBER OVER PARTITION BY
T7“Execute that query”Conversational context reference + T6 query reuse
Although wiiiv's DACS and HazardGuard do their best to prevent destructive operations, they cannot guarantee 100% safety. Please exercise extreme caution and always verify before executing any insert, modify, or delete operations on records, tables, or databases.