Skip to content

Instantly share code, notes, and snippets.

@shantanuo
Created April 28, 2014 08:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shantanuo/11365613 to your computer and use it in GitHub Desktop.
Save shantanuo/11365613 to your computer and use it in GitHub Desktop.
script to generate dates in mysql starting from 1-Jan-11 till today
#!/bin/sh
mysql test -Bse"drop table myserial"
mysql test -Bse"create table myserial (ticketDate date, primary key (ticketDate))"
for myserial in {1..2000}
do
mysql -Bse"insert into test.myserial select date_add('2011-01-01', interval $myserial day)"
done
mysql -Bse"delete from test.myserial where ticketDate > curdate()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment