IntelliJ IDEA倾向于将SQL文件格式化为一列

时间:2017-02-22 16:02:28

标签: sql intellij-idea code-formatting

我尝试使用IntelliJ IDEA格式化SQL文件并得到类似的结果:

INSERT IGNORE INTO SpectralImages
(scanDataID,
 imageToolsetID,
 imageTypeID,
 imageFilename,
 imageDSPath,
 fileID)
  (SELECT
     ScanData.scanDataID,
     1,
     Files.imageTypeID,
     Files.fileName,
     Files.fileDSPath,
     Files.fileID
   FROM ((
       Files
       LEFT JOIN
       Samples_Files
         ON (
         Samples_Files.fileID
         =
         Files.fileID)) LEFT JOIN
     Scans
       ON (
       Scans.sampleID
       =
       Samples_Files.sampleID)) JOIN
     ScanData
       ON (
       ScanData.scanID
       =
       Scans.scanID)
   WHERE
     Files.imageTypeID
     IS
     NOT
     NULL
     AND
     Files.fileID
     NOT
     IN
     (SELECT fileID
      FROM
        SpectralImages)
   GROUP BY
     scanDataID,
     Files.fileID);

显然它试图将每个术语分成不同的行。这是正常的吗?

是否有其他格式化选项包含更合理的换行符?

1 个答案:

答案 0 :(得分:0)

IntelliJ IDEA为SQL提供了许多格式化选项,您可以根据需要禁用换行符:

sql formatting