Convenient way to wrap long SQL statements in javascript

前端 未结 5 1496
别那么骄傲
别那么骄傲 2021-01-26 09:35

In python, one can use \"\"\" to wrap long MySQL statements. For example,

sql = \"\"\"CREATE TABLE EMPLOYEE (
         FIRST_NAME  CHAR(20) NOT NULL,
         L         


        
5条回答
  •  抹茶落季
    2021-01-26 10:25

    This shouldn't be a problem if you are using node.js that support ES6. ES6 javascript now supports multi-line string using syntax below.

    sql = `CREATE TABLE EMPLOYEE (
             FIRST_NAME  CHAR(20) NOT NULL,
             LAST_NAME  CHAR(20),
             AGE INT,  
             SEX CHAR(1),
             INCOME FLOAT )`
    

提交回复
热议问题