我想在mysql中生成测试数据
假设有一张这样的表,
create table person (
id int auto_increment primary key,
name text,
age int,
birth_day date
);
Run Code Online (Sandbox Code Playgroud)
让我知道如何以简单的方式创建测试数据。
顺便说一句,我知道一些使用标准输入的方法,比如
repeat 5 echo 'insert into person (name, age, birth_day) select concat("user", ceil(rand() * 100)), floor(rand()*100), date_add(date("1900/01/01"), interval floor(rand()*100) year);'
Run Code Online (Sandbox Code Playgroud)
或者
repeat 5 perl -M"Data::Random qw(:all)" -E 'say sprintf qq#insert into person (name, age, birth_day) values ("user%s", %s,"%s");#, (int rand(100)), (int rand(100)), rand_date(min => "1900-01-01", max=>"1999-12-31")'
Run Code Online (Sandbox Code Playgroud)
我认为后者可能更好,因为它不使用mysql函数。
我知道这很有效.
Preulde> 1::Int
1
Run Code Online (Sandbox Code Playgroud)
但这不起作用.
Preude> 1::Integral
Run Code Online (Sandbox Code Playgroud)
我想知道Int和Integral之间的区别.