Getting a random roll of the dice Using Mysql

by Mohan 2012-09-20 08:13:31

<font color=#0000CC>




<h2>Getting a random roll of the dice:</h2>

CREATE TABLE dice (
d_id int(11) NOT NULL auto_increment,
roll int,
PRIMARY KEY (d_id)
);

insert into dice (roll) values (1);
insert into dice (roll) values (2);
insert into dice (roll) values (3);
insert into dice (roll) values (4);
insert into dice (roll) values (5);
insert into dice (roll) values (6);


select roll from dice order by rand() limit 1;
</font>
657
like
0
dislike
0
mail
flag

You must LOGIN to add comments