Lesson 3 of 13 · 24 min
Operating expenses from the general ledger
By the end of this lesson you can report operating expenses from journal lines with the right sign, the right entries (posted only), the right period (fiscal period, not entry date) and an explicit bucket for unallocated cost.
The ledger dataset is the general ledger (GL) of Tahlia Trading Company, a fictional Saudi distributor. Every financial event is a journal entry (journal_entries, the header: date, period, source, status) made of two or more journal lines (journal_lines: an account, an optional cost center, and a debit or a credit). Double entry means the debits of an entry equal its credits.
The chart of accounts (gl_accounts) is a small hierarchy. Header accounts (is_postable = false) such as 6000 Operating Expenses group the postable accounts below them through parent_account_code:
4xxxrevenue,5xxxcost of sales,6xxxoperating expenses (P&L accounts)1xxxassets,2xxxliabilities,3xxxequity (balance-sheet accounts)
Operating expenses (opex) in this course are the postable accounts whose parent is 6000: salaries, rent, utilities, marketing, and so on. Cost of sales (5xxx) is reported separately, above gross profit.
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