I need to populate a currently empty table with a hundred or so fake records to simulate logins over the past two years to test my code with.
The login table schema looks like:
CREATE TABLE `Logins` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`User_ID` int(11) NOT NULL,
`Date_Login` datetime NOT NULL,
`Location` enum('site','admin') NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
I really am new at SQL in general, so, I don't have the slightest idea what the query should look like past
INSERT INTO `Logins` (`User_ID`,`Date_Login`,`Location`) VALUES ...
What I need is insert N entries (lets say 100) into Logins
so that
User_ID
draws its values from theUsers
table'sID
fieldDate_Login
should be between 2 years ago and nowLocation
should alternate between'site'
and'admin'
, but with'site'
more heavily weighted (say 80% of the time).
Hopefully, I can glean some SQL-fu to help with similar problems in the future :D
Thanks!
(I'm using MySQL 5.1)