📅  最后修改于: 2023-12-03 15:26:35.618000             🧑  作者: Mango
本篇文章将介绍柜员、邮票、BMO和PDF相关的SQL代码示例。
SELECT teller_id, COUNT(*) as num_transactions, SUM(amount) as total_amount
FROM transactions
GROUP BY teller_id;
SELECT teller_id, COUNT(*) as num_transactions, COUNT(*) / DATEDIFF(MAX(date), MIN(date)) as avg_daily_transactions
FROM transactions
GROUP BY teller_id;
SELECT *
FROM stamps
ORDER BY type ASC;
SELECT type, COUNT(*) as num_stamps, MIN(price) as min_price, MAX(price) as max_price
FROM stamps
GROUP BY type;
SELECT branch_name,
CASE
WHEN branch_id < 100 THEN 'Small'
WHEN branch_id between 100 and 200 THEN 'Medium'
ELSE 'Large'
END as branch_size
FROM branches;
SELECT branch_id, AVG(balance) as avg_balance
FROM accounts
GROUP BY branch_id;
SELECT *
FROM pdf_documents
WHERE MATCH(content) AGAINST ('database' IN NATURAL LANGUAGE MODE);
SELECT document_id,
REGEXP_SUBSTR(content, 'Order Number: (\d+)') as order_number,
REGEXP_SUBSTR(content, 'Total Amount: \$(\d+\.\d{2})') as total_amount,
REGEXP_SUBSTR(content, 'Customer Name: (.+)') as customer_name
FROM pdf_documents;
以上是与柜员、邮票、BMO和PDF相关的SQL代码示例。无论你是需要掌握柜员统计还是PDF文档中关键词搜索,这些SQL代码示例能够帮助你更好地了解和掌握相关的技术。