Lesson 6 of 13 · 26 min
The trial balance
By the end of this lesson you can produce a trial balance at a period end with debit and credit balance columns, prove it balances, locate unbalanced entries, and present a fiscal-year trial balance with prior-year profit in retained earnings.
A trial balance (TB) lists every account with its balance at a point in time, split into a debit balance column and a credit balance column. Because every posted entry has equal debits and credits, the two columns must total the same amount. If they don't, something that isn't proper double entry has crept in.
Building one from journal lines takes three decisions:
- As at when? A TB is cumulative: it includes every posted line from the opening balances up to and including the chosen period. In
ledgerthat meansperiod_id <= 202506for the TB at 30 June 2025. (The opening entryOB-2024in period 202401 carries the balance sheet in from before 2024.) - Which entries? Posted only. Drafts are not in the books.
- Which column? Compute the net
debit − creditper account. A positive net is a debit balance; a negative net is a credit balance (shown as a positive number in the credit column).
This lesson, its 4 graded exercises and every other Members lesson in SQL Quest come with a Formula Quest membership that includes SQL (Single Quest with SQL selected, Quest Trio including SQL, or Quest Unlimited), or with SQL access from your organization.
Free to everyone: all of SQL Foundations and Retrieving and Filtering Data, the first lesson of every track, the playground, the dataset library and the SQL reference. See free lessons