The Mechanics of Accounting

The Journal


The journal is the book of original entry where every transaction is first recorded in chronological order. Each entry shows which accounts are affected, the amounts, and whether they are debited or credited.

Rules of Debit and Credit


Every transaction affects at least two accounts.

Debits increase Assets and Expenses; decrease Liabilities, Equity, and Revenue.

Credits increase Liabilities, Equity, and Revenue; decrease Assets and Expenses.

Journalizing Transactions


This is the process of analyzing each transaction and writing it as a journal entry with dates, account titles, debit and credit amounts, and a brief description.

Ledger


The ledger is the book of final entry. It contains all accounts grouped by type (Assets, Liabilities, Equity, Revenue, Expenses) showing their cumulative balances.

Posting


Posting transfers each journal entry from the journal into the appropriate ledger accounts so that each account shows its running total balance.

Normal Balance


Every account has a side—debit or credit—where it normally increases. This is its normal balance. For example:

Assets, Expenses → Debit

Liabilities, Equity, Revenue → Credit

Trial Balance


After posting, the ledger balances are listed in a trial balance to verify that total debits equal total credits. This ensures mathematical accuracy before preparing financial statements.

Connection to the Accounting Model

In the Accounting Model System, each step is implemented through database tables and views:

Accounting StepModel ComponentDescriptionSample SQL/PLSQL Template Code
1. JournalJS_JOURNAL_ENTRIES tableStores each transaction with date, debit, credit, and description.sql\n-- Insert a new journal entry\nINSERT INTO JS_JOURNAL_ENTRIES (entry_id, entry_date, account_id, debit_amt, credit_amt, description)\nVALUES (JS_JOURNAL_SEQ.NEXTVAL, SYSDATE, :account_id, :debit_amt, :credit_amt, 'Sale of goods');\n\nCOMMIT;
2. Rules of Debit & CreditPL/SQL trigger or constraintEnsures double-entry rule: total debits = total credits for each journal batch.sql\n-- Trigger to enforce double-entry balance\nCREATE OR REPLACE TRIGGER trg_check_balance\nAFTER INSERT OR UPDATE ON JS_JOURNAL_ENTRIES\nDECLARE\n v_total_debit NUMBER;\n v_total_credit NUMBER;\nBEGIN\n SELECT SUM(debit_amt), SUM(credit_amt)\n INTO v_total_debit, v_total_credit\n FROM JS_JOURNAL_ENTRIES\n WHERE entry_batch_id = :NEW.entry_batch_id;\n\n IF v_total_debit != v_total_credit THEN\n RAISE_APPLICATION_ERROR(-20001, 'Debits and Credits must balance!');\n END IF;\nEND;
3. Journalizing TransactionsAPEX form or SQL insertUsers enter transactions that automatically post to journal table.sql\n-- Example form submission or manual insert\nINSERT INTO JS_JOURNAL_ENTRIES (entry_date, account_id, debit_amt, credit_amt, description)\nVALUES (TO_DATE('2025-10-11','YYYY-MM-DD'), 101, 0, 500, 'Service Revenue');\n\nCOMMIT;
4. LedgerJS_LEDGER_ACCOUNTS viewSummarizes transactions by account showing running balances.sql\n-- Create Ledger View\nCREATE OR REPLACE VIEW JS_LEDGER_ACCOUNTS AS\nSELECT a.account_id,\n a.account_name,\n SUM(j.debit_amt - j.credit_amt) AS balance\nFROM JS_ACCOUNTS a\nLEFT JOIN JS_JOURNAL_ENTRIES j ON a.account_id = j.account_id\nGROUP BY a.account_id, a.account_name;
5. PostingSQL procedure or jobTransfers journal entries to ledger by updating balances.sql\n-- Example Posting Procedure\nCREATE OR REPLACE PROCEDURE JS_POST_JOURNAL AS\nBEGIN\n UPDATE JS_ACCOUNTS a\n SET a.account_balance = (\n SELECT NVL(SUM(j.debit_amt - j.credit_amt),0)\n FROM JS_JOURNAL_ENTRIES j\n WHERE j.account_id = a.account_id\n );\n\n COMMIT;\nEND JS_POST_JOURNAL;\n/\n\n-- Run posting\nEXEC JS_POST_JOURNAL;
6. Normal Balanceaccount_type field in JS_ACCOUNTSDefines which side (Debit or Credit) increases the account’s balance.sql\n-- Sample Account Table with Normal Balance\nCREATE TABLE JS_ACCOUNTS (\n account_id NUMBER PRIMARY KEY,\n account_name VARCHAR2(100),\n account_type VARCHAR2(20) CHECK (account_type IN ('Asset','Liability','Equity','Revenue','Expense')),\n normal_balance VARCHAR2(6) CHECK (normal_balance IN ('Debit','Credit')),\n account_balance NUMBER DEFAULT 0\n);\n\n-- Example Insert\nINSERT INTO JS_ACCOUNTS VALUES (101, 'Cash', 'Asset', 'Debit', 0);
7. Trial BalanceV_TRIAL_BALANCE viewAggregates ledger balances and verifies equality of total debits and credits.sql\n-- Create Trial Balance View\nCREATE OR REPLACE VIEW V_TRIAL_BALANCE AS\nSELECT a.account_name,\n CASE WHEN a.normal_balance = 'Debit' THEN balance ELSE 0 END AS debit,\n CASE WHEN a.normal_balance = 'Credit' THEN ABS(balance) ELSE 0 END AS credit\nFROM JS_LEDGER_ACCOUNTS a;\n\n-- View Trial Balance\nSELECT * FROM V_TRIAL_BALANCE;\n\n-- Verify totals\nSELECT SUM(debit) AS total_debits, SUM(credit) AS total_credits\nFROM V_TRIAL_BALANCE;

Summary:
The manual accounting cycle’s flow

Journal → Ledger → Trial Balance → Financial Statements

is mirrored digitally in the Accounting Model, where tables record transactions, constraints enforce debit/credit rules, and views produce automated financial summaries (like the Trial Balance, Income Statement, and Balance Sheet).