生成插入语句的java程序应用于商品日期表(版本2)
发布日期:2021-06-29 16:59:01 浏览次数:2 分类:技术文章

本文共 2146 字,大约阅读时间需要 7 分钟。

import java.text.DecimalFormat;//生成插入语句的java程序应用于商品日期表(版本2)public class demo2 {    public static void main(String[] args) {        //把商品的productid抽出单写,减少修改,加快insert的生成效率        String month = "3";        //五月        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/117389062 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:BOOST_CONSTANTS_GENERATE宏相关用法的测试程序
下一篇:boost::math模块计算 Bessel、Neumann 和 Airy 函数的零(或根)的函数的测试程序

发表评论

最新留言

能坚持,总会有不一样的收获!
[***.219.124.196]2024年04月09日 01时14分01秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章