SELECT
concat(
CONCAT(
FLOOR(
2019 + ( RAND() * 1 )),
'-',
LPAD( FLOOR( 10 + ( RAND() * 2 )), 2, 0 ),
'-',
LPAD( FLOOR( 1 + ( RAND() * 25 )), 2, 0 )),
' ',
CONCAT(
LPAD( FLOOR( 0 + ( RAND() * 23 )), 2, 0 ),
':',
LPAD( FLOOR( 0 + ( RAND() * 59 )), 2, 0 ),
':',
LPAD( FLOOR( 0 + ( RAND() * 59 )), 2, 0 )))
FROM
DUAL;
-- 构造测试数据,日期随机
INSERT INTO res_userloginfo ( aa, bb, cc, logtime, ee )
SELECT
aa,
bb,
cc,
STR_TO_DATE(
concat(
CONCAT(
FLOOR(
2019 + ( RAND() * 1 )),
'-',
LPAD( FLOOR( 10 + ( RAND() * 2 )), 2, 0 ),
'-',
LPAD( FLOOR( 1 + ( RAND() * 25 )), 2, 0 )),
' ',
CONCAT(
LPAD( FLOOR( 0 + ( RAND() * 23 )), 2, 0 ),
':',
LPAD( FLOOR( 0 + ( RAND() * 59 )), 2, 0 ),
':',
LPAD( FLOOR( 0 + ( RAND() * 59 )), 2, 0 ))
),
'%Y-%m-%d %H:%i:%s'
) ,
ee
FROM
res_userloginfo;