Picking up SQL and Postgres, is there a shorter way to write the INSERT SQL query than the code below?
Not a problem writing it this way but it's very long and requires lots of scrolling. I could write it as a paragraph with no linebreak after the commas but then it's hard to keep track of which variable/column/value goes with what in VSCODE.
Maybe there's a way to shorten the values variables such as writing something like $1-$39?
const addItemSql = `
INSERT INTO users (
address,
city,
state,
postal,
description,
bedrooms,
bathrooms,
sqft,
lotSize,
.....(20 more items)
) VALUES (
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8,
$9,
$10,
$11,
$12,
$13,
$14,
$15,
$16,
$17,
$18,
$19,
$20,
$21,
$22,
$23,
$24,
$25,
$26,
$27,
$28,
$29,
$30,
$31,
$32,
$33,
$34,
$35,
$36,
$37,
$38,
$39,
) RETURNING *`
const { rows: addedItem } = await pool.query(addItemSql, [
address,
city,
state,
postal,
description,
bedrooms,
bathrooms,
sqft,
lotSize,
.....(20 more items)
])