【狂神說Java】MySQL最新教程通俗易懂

p16 自動生成1000條數(shù)據(jù)
INSERT INTO result (`studentno`, `loginpwd`, `studentname`, `sex`, `gradeid`, `phone`, `address`, `borndate`, `email`, `identitycard`)
SELECT?
??a.n,?
??CONCAT('password', a.n),?
??CONCAT('name', a.n),
??ROUND(RAND()),
??ROUND(RAND() * 100),
??CONCAT('phone', a.n),
??CONCAT('address', a.n),
??FROM_UNIXTIME(RAND() * UNIX_TIMESTAMP()),
??CONCAT('email', a.n, '@example.com'),
??CONCAT(ROUND(RAND() * 1000000000 + 1000000000), ROUND(RAND() * 100000000 + 10000000))
FROM?
??(SELECT @rownum:=@rownum+1 as n
??FROM?
????(SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4?
?????UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) t1,?
????(SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4?
?????UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) t2,?
????(SELECT 0 UNION ALL SELECT 1 UNION ALL SELECT 2 UNION ALL SELECT 3 UNION ALL SELECT 4?
?????UNION ALL SELECT 5 UNION ALL SELECT 6 UNION ALL SELECT 7 UNION ALL SELECT 8 UNION ALL SELECT 9) t3,?
????(SELECT @rownum:=0) r
??) a
LIMIT 1000;