mysql 函数造数_mysql造数

SELECT FLOOR(2 + RAND()*3)

SELECT question_id as question_id,

create_time as start_time,

3 as term,

DATE_ADD(create_time,INTERVAL FLOOR(2 + RAND()*3) MONTH) as end_time,

IF(problem_type = 'A',1,0) as point_someone,

IF(problem_type = 'E',1,0) as point_something,

FLOOR(0.5 + RAND()) as analogy,

FLOOR(0.5 + RAND()) as establishment,

null as implementation

from ods_question_csix;

create table dw_factor01 as (SELECT * from dw_factor where id = 100000);

INSERT into dw_factor01 (question_id,start_time,term,end_time,point_someone,point_something,analogy,establishment,implementation)(

SELECT question_id as question_id,

create_time as start_time,

3 as term,

DATE_ADD(create_time,INTERVAL FLOOR(2 + RAND()*3) MONTH) as end_time,

IF(problem_type = 'A',1,0) as point_someone,

IF(problem_type = 'E',1,0) as point_something,

FLOOR(0.5 + RAND()) as analogy,

FLOOR(0.5 + RAND()) as establishment,

null as implementation

from ods_question_csix

);

SELECT question_id as question_id,start_time as start_time,term as term,end_time as end_time,point_someone as point_someone,

point_something as point_something,analogy as analogy,establishment as establishment,

IF(establishment = 1,FLOOR(0.5 + RAND()),0) as implementation from dw_factor01 ;

create table dw_factor02 as (SELECT * from dw_factor01 where id = 100000);

INSERT into dw_factor02 (question_id,start_time,term,end_time,point_someone,point_something,analogy,establishment,implementation)(

SELECT question_id as question_id,start_time as start_time,term as term,end_time as end_time,point_someone as point_someone,

point_something as point_something,analogy as analogy,establishment as establishment,

IF(establishment = 1,FLOOR(0.5 + RAND()),0) as implementation from dw_factor01

);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值