Integer

functional

Choose the grouping, sign, and units that make whole numbers quick to read.

For whole-number columns, Settings › Results › Integer holds the choices that make counts, quantities, and large values easier to scan.

OptionChoicesDefault
Thousands separatorsOn / off (grouped with commas)On
Reduce large numbersAbbreviate to K / M / G / T / POff
Metric thresholdSmallest value that is abbreviated1000
Negative formatMinus sign (-42) / Parentheses ((42))Minus sign
AlignmentLeft / Center / RightRight
SQLly
SQLly integer formatting configuration panelSQLly integer formatting configuration panel
The integer formatting panel in Settings, with a live sample.

What the grid shows

A few values under different settings, exactly as an integer cell draws them:

ValueSettingsGrid shows
1234567Defaults1,234,567
1234567Thousands separators off1234567
-1234Defaults-1,234
-1234Negative format: Parentheses(1,234)
9223372036854775807Defaults9,223,372,036,854,775,807

Integers group with a comma, the thousands and decimal characters under Decimal apply to decimal columns only, and the integer sample in Settings groups the same way. Integers up to the 64-bit limit are drawn digit for digit - SQLly does not round large bigint values through a floating-point number on the way to the screen.

Reduce large numbers

With Reduce large numbers on, integer cells at or above the Metric threshold are abbreviated with K, M, G, T, or P and two decimals. The same rule shapes the sample in Settings and the counts SQLly reports about your results - the Result 1: … row(s) label and the Completed in … ms line in Messages.

ValueThreshold 1000, offThreshold 1000, onThreshold 10000, on
999999999999
15001,5001.50K1,500
1212812,12812.13K12.13K
12345671,234,5671.23M1.23M
-2500000000-2,500,000,000-2.50G-2.50G
  • The threshold only decides what is abbreviated. The letters always mean thousand, million, billion, trillion, and quadrillion, so a threshold of 10000 leaves 5,000 in full and shows 15000 as 15.00K. A threshold below 1000 abbreviates nothing extra, there is no letter for a value under a thousand.
  • Display only. The cell still holds the exact number: sorting, numeric filters, copy, and export all use it. A text filter matches what you see, so 1.50k finds the abbreviated cell.
  • Negatives keep your negative format - -1.50K, or (1.50K) with parentheses.

One column at a time

Right-click an integer column's header and choose Format › Set Formatting Override… for a per-column choice that is saved into the query:

  • Thousands separators or Plain integer - turn grouping on or off for just this column.
  • Epoch seconds → date/time and Epoch milliseconds → date/time - show a Unix timestamp as a readable date. See Dates.

Plain integer is the one to reach for on identifiers and years. Grouping is great for quantities but turns an order number into 1,048,576 and a MySQL YEAR column into 2,026. The menu offers the integer list for int, bigint, smallint, tinyint, and serial columns; for other integer types such as YEAR, type the same directive yourself:

-- sqlly format: column=OrderID; number=0; thousands=false
-- sqlly format: column=FiscalYear; number=0; thousands=false
SELECT OrderID, FiscalYear, SUM(Quantity) AS Units
FROM sales
GROUP BY OrderID, FiscalYear;

A number= directive sets the column's places and grouping and keeps the rest of its integer settings - Negative format and Alignment still apply. Fixed places also means the column is never abbreviated, even with Reduce large numbers on.

Elsewhere in SQLly

  • Selection summary. Select integer cells and the Count, Sum, Min, Max, and Distinct figures under the grid use your thousands and negative settings (but are never abbreviated).
  • Copy and export. These always carry the raw number - 1,234,567 on screen copies as 1234567, and spreadsheets receive a real number. See Export.
  • NULL is never formatted; it shows as an italic NULL.