【问题标题】:what is the table design for this json request这个 json 请求的表设计是什么
【发布时间】:2021-12-12 09:43:18
【问题描述】:

请求正文

{
    "standard": '',
    "section": '',
    "subject": '',
    "type" : '',
    "startTime": '',
    "allDayEvent": false,
    "startTimezone": '',
    "endTimezone": '',
    "endTime": ''  ,
    "repeat": {
        "frequency": 'Never',
        "interval": '',
        "recurrencePattern": {
            "weekly": {
            "weeklydaysOfWeek": null
        },
        "monthly": {
            "monthlydayOfMonth": 0,
            "monthlyIndex": '',
            "monthlydayOfWeek": null                       
        },
        "yearly": {
            "month": 0,
            "yearlydayOfMonth": 0,
            "yearlyIndex": '',
            "yearlydayOfWeek": null                  
        }
    },
    "until":{
        "neverFlag": false,
        "occurrence": 0,
        "endDate": null
    }
}

我可以为此创建多少表,并且在每周几天我们将获得多天,所以我如何单独存储这些工作日。我必须根据它所在的结束日期提供详细信息,直到对象。

【问题讨论】:

  • 您可以将所有内容放在一个大的 JSON 字段中。
  • @Teja Sree 你用的是什么数据库?
  • @ArunSai MySql 工作台
  • 从 1 到 7(你可以创建更多的表,但这绝对不合理)。最合理的数量似乎是 4 张桌子。
  • @Tejasree ,“MySql WorkBench”不是数据库,它是数据库工具。要确认您使用的是 MySQL,请在工作台中运行 SELECT version(); 并发布结果。

标签: mysql json spring-boot database-table


【解决方案1】:

检查下面的 SQL

/* CREATE TABLE */
CREATE TABLE test(
`standard` VARCHAR(100),
`section` VARCHAR(100),
`subject` VARCHAR(100),
`type` VARCHAR(100),
`startTime` VARCHAR(100),
`allDayEvent` VARCHAR(100),
`startTimezone` VARCHAR(100),
`endTimezone` VARCHAR(100),
`endTime` VARCHAR(100),
`repeatfrequency` VARCHAR(100),
`repeatinterval` VARCHAR(100),
`repeatrecurrencePatternweeklyweeklydaysOfWeek` VARCHAR(100),
`repeatrecurrencePatternmonthlymonthlydayOfMonth` DOUBLE,
`repeatrecurrencePatternmonthlymonthlyIndex` VARCHAR(100),
`repeatrecurrencePatternmonthlymonthlydayOfWeek` VARCHAR(100),
`repeatrecurrencePatternyearlymonth` DOUBLE,
`repeatrecurrencePatternyearlyyearlydayOfMonth` DOUBLE,
`repeatrecurrencePatternyearlyyearlyIndex` VARCHAR(100),
`repeatrecurrencePatternyearlyyearlydayOfWeek` VARCHAR(100),
`repeatuntilneverFlag` VARCHAR(100),
`repeatuntiloccurrence` DOUBLE,
`repeatuntilendDate` VARCHAR(100)
);

/* INSERT QUERY NO: 1 */
INSERT INTO test(`standard`, `section`, `subject`, `type`, `startTime`, `allDayEvent`, `startTimezone`, `endTimezone`, `endTime`, `repeatfrequency`, `repeatinterval`, `repeatrecurrencePatternweeklyweeklydaysOfWeek`, `repeatrecurrencePatternmonthlymonthlydayOfMonth`, `repeatrecurrencePatternmonthlymonthlyIndex`, `repeatrecurrencePatternmonthlymonthlydayOfWeek`, `repeatrecurrencePatternyearlymonth`, `repeatrecurrencePatternyearlyyearlydayOfMonth`, `repeatrecurrencePatternyearlyyearlyIndex`, `repeatrecurrencePatternyearlyyearlydayOfWeek`, `repeatuntilneverFlag`, `repeatuntiloccurrence`, `repeatuntilendDate`)
VALUES ('', '', '', '', '', 'false', '', '', '', 'Never', '', '', 0, '', '', 0, 0, '', '', 'false', 0, '');

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-12
    • 1970-01-01
    • 1970-01-01
    • 2019-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多