有没有什么SQL小提琴可以处理的限制? SQL拨弄不编译任何东西,没有返回错误信息(is the

2019-09-21 06:18发布

我最近创建了成功编译并返回所需结果的查询。 当我用这段代码在另一段代码,关于计算器用户想出了我一个子查询,我遇到了一些问题,这些问题最终都解决了。 我试图用这个查询在这段代码给我一个子查询。 但是,SQL拨弄不返回任何东西。 没有错误或编译的消息。 当我试图把语法错误的目的,就像一个随机+号,什么都没有发生。 是不是因为查询过长?

模式

CREATE TABLE sampleData 
    (
     id MEDIUMINT NOT NULL AUTO_INCREMENT,
      timecode int, 
     count int,
      PRIMARY KEY (id)
    )
#ENGINE=MyISAM
;

INSERT INTO sampleData
(timecode, count)
VALUES
(1344893440, 1), ( 1346014720, 1),( 1344898688,1),( 1345654784,1),( 1345978368,1),
( 1345959296,1), (1345064704,1), ( 1345156352,1),( 1345225600,1),
(1345017984,1),( 1345640960,1),( 1346019968,1),( 1345834752,1),
( 1345438464,1),( 1344986880,1),( 1345045632,1),( 1345557888,1),( 1344973056,1),( 1345087232,1),( 1345433216,1),( 1345691008,1),
( 1344917760,1),( 1345253248,1),( 1344934912,1),( 1345890048,1),( 1345272448,1), (1345829504,1),( 1345798400,1),( 1345203200,1),( 1344741120,1),
( 1345175552,1),( 1344824192,1),( 1344926336,1),( 1345571712,1),( 1344931584,1),( 1345211776,1),( 1345059456,1),( 1345516288,1),( 1345441920,1),( 1346009472,1)

询问

select t_0.*,
           (coalesce(t_3.average_number_of_votes_per_previous_period_days, 0) - coalesce(t_4.average_number_of_votes_per_previous_period_days, 0)) * 100.0
    from 
        (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2)t_0 
    left outer join
         (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2) t_3
         on t.ordr = t_3.ordr + 1 
    left outer join
         (select t.*,
           (coalesce(t_1.count, 0) - coalesce(t_2.count, 0)) * 100.0 as "percentage increase in count in %"
    from  
    (
      SELECT sum(1) AS ordr,
      t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"

      FROM 
        (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t1
        INNER JOIN 
        (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
        FROM sampleData
        GROUP BY DAY) t2 
        on t1.day >= t2.day                                                                                                                                
        GROUP BY t1.day, t1.count
        ORDER BY t1.day
        )t 
      left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
            (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t1
          INNER JOIN 
            (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
            FROM sampleData
            GROUP BY DAY) t2 
          on t1.day >= t2.day                                                                                                                                
          GROUP BY t1.day, t1.count
          ORDER BY t1.day
          )t_1
       on t.ordr = t_1.ordr + 1 left outer join
         (
          SELECT sum(1) AS ordr,
            t1.id,t1.day, t1.count, SUM(t2.count) as aggregate, (SUM(t2.count)-t1.count)/(sum(1)-1) as "average_number_of_votes_per_previous_period_days"
          FROM 
              (SELECT  id, date(FROM_UNIXTIME( timecode))  AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t1
            INNER JOIN 
              (SELECT date(FROM_UNIXTIME( timecode) ) AS day,(FROM_UNIXTIME( timecode)) AS original, COUNT(1)  as 'count'
              FROM sampleData
              GROUP BY DAY) t2 
            on t1.day >= t2.day                                                                                                                                
            GROUP BY t1.day, t1.count
            ORDER BY t1.day
            ) t_2
        on t.ordr = t_2.ordr + 2) t_4
        on t_0.ordr = t_4.ordr + 2

Answer 1:

我插你的查询在此小提琴,我现在看到的问题。 您所查询的是超过8000个字符(8423是精确的),我不会显示结果面板上的消息。 基本上,这是SQL小提琴显示错误,我以前没注意到(所以,感谢您将这一引起我的注意!)。

在此同时,你可以尝试切割出某些字符,以使其适合8000个字符的限制之内。



文章来源: is there a limit to what sql fiddle can handle? sql fiddle doesn't compile anything and returns no error messages