生成插入语句的java程序应用于商品日期表(版本3)
发布日期:2021-06-29 16:58:53
浏览次数:2
分类:技术文章
本文共 2396 字,大约阅读时间需要 7 分钟。
import java.text.DecimalFormat;//生成插入语句的java程序应用于商品日期表(版本3)public class demo2 { public static void main(String[] args) { shengInsert("4"); shengInsert("5"); shengInsert("6"); shengInsert("7"); shengInsert("8"); shengInsert("9"); shengInsert("10"); shengInsert("11"); } static void shengInsert(String m){ //把商品的productid抽出单写,减少修改,加快insert的生成效率 String month = m; //五月 for (int i=1;i<=31;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20210500"+month+i+"', '"+month+"', '2021-05-"+i+"', "+str+", 1);"); } //六月 for (int i=1;i<=30;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20210600"+month+i+"', '"+month+"', '2021-06-"+i+"', "+str+", 1);"); } //七月 for (int i=1;i<=31;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20210700"+month+i+"', '"+month+"', '2021-07-"+i+"', "+str+", 1);"); } //八月 for (int i=1;i<=31;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20210800"+month+i+"', '"+month+"', '2021-08-"+i+"', "+str+", 1);"); } //九月 for (int i=1;i<=30;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20210900"+month+i+"', '"+month+"', '2021-09-"+i+"', "+str+", 1);"); } //十月 for (int i=1;i<=31;i++){ double a=Math.random()*1000; DecimalFormat df = new DecimalFormat( "0.00" ); String str=df.format( a ); System.out.println("INSERT INTO `productdate` VALUES ('20211000"+month+i+"', '"+month+"', '2021-10-"+i+"', "+str+", 1);"); } }}
转载地址:https://superman.blog.csdn.net/article/details/117389129 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
感谢大佬
[***.8.128.20]2024年04月13日 05时14分06秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
带搜索框的jQuery下拉框插件
2019-04-30
Oracle闪回查询
2019-04-30
MySQL 安装步骤
2019-04-30
JAVA JDBC 增删改查简单例子
2019-04-30
Oracle用户被锁定解决方法
2019-04-30
Tomcat和weblogic虚拟路径的配置
2019-04-30
activiti 5.13流程图连线名称不显示bug修复
2019-04-30
oracle sqlplus一些命令
2019-04-30
WinForm 中 Log4net 配置写不同文件
2019-04-30
操作App.config与Web.config文件
2019-04-30
Spring Boot 2 入手
2019-04-30
C# Socket连接请求超时机制
2019-04-30
Windows7下安装redmine-3.4.6
2019-04-30
SpringBoot执行定时任务
2019-04-30
win7 64位下redis的安装
2019-04-30
winform中读写SQLite数据库例子
2019-04-30
ECharts上手例子
2019-04-30
SQLite 查询时异常:该字符串未被识别为有效的 DateTime 错误
2019-04-30
c# Socket发送与接收方法
2019-04-30