/*
 Navicat Premium Dump SQL

 Source Server         : 192.168.0.222
 Source Server Type    : MySQL
 Source Server Version : 80031 (8.0.31)
 Source Host           : 192.168.0.222:3306
 Source Schema         : ry_refactor0120

 Target Server Type    : MySQL
 Target Server Version : 80031 (8.0.31)
 File Encoding         : 65001

 Date: 24/01/2026 10:59:56
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for t_stock_basic
-- ----------------------------
DROP TABLE IF EXISTS `t_stock_basic`;
CREATE TABLE `t_stock_basic`  (
  `stock_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '证券代码（如000061.SZ、600000.SH）',
  `stock_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '证券名称（如“农 产 品”）',
  `listing_date` date NULL DEFAULT NULL COMMENT '首发上市日期',
  `listing_days` int NULL DEFAULT NULL COMMENT '上市天数（冗余存储，提升查询效率）',
  `is_st` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为ST股票（1=是，0=否）',
  `is_star_st` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否为*ST股票（1=是，0=否）',
  `industry_index_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '所属行业指数代码（关联t_industry_index）',
  `industry_index_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '所属行业指数名称（冗余存储，减少关联查询）',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '数据创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '数据更新时间',
  PRIMARY KEY (`stock_code`) USING BTREE,
  INDEX `idx_t_stock_basic_industry`(`industry_index_code` ASC) USING BTREE,
  CONSTRAINT `t_stock_basic_ibfk_1` FOREIGN KEY (`industry_index_code`) REFERENCES `t_industry_basic` (`industry_code`) ON DELETE RESTRICT ON UPDATE CASCADE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = 'A股个股基础信息' ROW_FORMAT = Dynamic;

SET FOREIGN_KEY_CHECKS = 1;
