Your question is Prepayment and Journal Entry. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
What is Prepayment? and tell me journal entry
Write a PostgreSQL query that identifies posted prepayment records and returns the corresponding accounting entry. A prepayment is an amount paid before the related goods or services are received, normally recorded by debiting a prepaid asset and crediting cash or accounts payable.
prepayment_id, description, amount, debit account details, and credit account detailspayment_date ascending, then prepayment_id ascending| Column | Type | Description |
|---|---|---|
| prepayment_idPK | INT | Unique prepayment identifier |
| description | VARCHAR(150) | Description of the prepaid item or service |
| payment_date | DATE | Date the payment was recorded |
| amount | NUMERIC(12,2) | Prepayment amount |
| payment_timing | VARCHAR(20) | Whether payment was made before or after receipt |
| status | VARCHAR(20) | Accounting posting status |
| debit_account_code | VARCHAR(20) | Account debited for the prepayment |
| credit_account_code | VARCHAR(20) | Account credited for the prepayment |
| Column | Type | Description |
|---|---|---|
| account_codePK | VARCHAR(20) | General ledger account code |
| account_name | VARCHAR(100) | General ledger account name |
| account_type | VARCHAR(30) | Classification of the account |