ehm ```debt: SELECT id, amount, otherAmount, ...
# squarelibraries
u
ehm
Copy code
debt:
SELECT
    id, amount, otherAmount, suspended, otherAmountLevel, lastOverUsagePaymentTimestamp, otherAmountComputedTimestamp,
    details, payment_mutationState, payment_mutationId, payment_mutationTimestamp, subscriberId
FROM debt
WHERE subscriberId=?
LIMIT 1;
how do YOU format long projections? keep it horizontally scrolling? column on new line? tabbed or not tabbed?
e
Depends on the situation, but I'll usually go with one per line
u
do you then indent or not?
if so, do you then indent other parts as well?
Copy code
SELECT
    column,
    column,
    column,
    column,
    column,
FROM
    table
j
Trailing commas are not allowed. I tend to do
Copy code
SELECT
    column
  , column
  , column
  , column
  , column
FROM
    table
because the likelihood that you change the first column is near 0% (as it's usually the ID) whereas the likelihood you change the other columns is high relatively to the first.
it ensures the diff only ever affects a single line with addition/removal
u
neat .. okay so if it fits onto a line, then don't indent
Copy code
SELECT column1, column2
FROM table
otherwise column per line + indent for everything, or do you find this still cool?
Copy code
SELECT
    column
  , column
  , column
  , column
  , column
FROM table
WHERE id=?