crypto_quant/sql/table/crypto_market_data.sql

25 lines
864 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 临时禁用安全模式
SET SQL_SAFE_UPDATES = 0;
CREATE TABLE IF NOT EXISTS crypto_market_data (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
symbol VARCHAR(50) NOT NULL,
bar VARCHAR(20) NOT NULL,
timestamp BIGINT NOT NULL,
date_time VARCHAR(50) NOT NULL,
open DECIMAL(20,5) NOT NULL,
high DECIMAL(20,5) NOT NULL,
low DECIMAL(20,5) NOT NULL,
close DECIMAL(20,5) NOT NULL,
volume DECIMAL(30,8) NOT NULL,
volCcy DECIMAL(30,8) NOT NULL,
volCCyQuote DECIMAL(30,8) NOT NULL,
UNIQUE KEY uniq_symbol_bar_timestamp (symbol, bar, timestamp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--添加一列create_time格式为字符串
ALTER TABLE crypto_market_data ADD COLUMN create_time VARCHAR(50);
--更新create_time列的值为指定时间
UPDATE crypto_market_data SET create_time = '2025-07-28 11:00:00' WHERE id > 0;