Structuring Database for Accounting

Structuring Database for Accounting · CBSE / NCERT · Page 37

  • 2 min read
This is a small part of a chapterBooks of Prime Entry: notes, questions and quiz

Full lesson

applying any condition. This in turn means that all tuples of a relation specified in FROM clause qualify for being selected for the result of query. Consider the following query with reference to Model-I. (4) Find out the list of accounts which have been debited ( Model-I ) SELECT DISTINCT Debit As Code FROM vouchers; 541 (Model-II) AccCode As Code vouchers vType = 0 ; UNION Details.Code vouchers, Details vType = 1 AND vouchers.vNo = Details.vNo; Save above query as DebitAccounts, and thereafter execute another query as given below to get the final results.

SELECT DISINCT * Debit Accounts ; (5) Find out the list of accounts which have been credited ( Model-I ) SELECT DISTINCT Credit As Code vouchers ; ( Model-II ) AccCode As Code vouchers Vtype = 1; UNION Details.Code vouchers, Details vType = 0 AND vouchers.vNo = Details.vNo; Save above query as CreditAccounts, and thereafter execute another query as given below to get the final results. SELECT DISINCT * CreditAccounts; (6) Find out the list of accounts which have been debited as well as credited ( Model-I ) SELECT DISTINCT Debit As Code vouchers Debit IN (SELECT Credit As Code vouchers); 542 ( Model-II ) SELECT * DebitAccounts Code IN ( SELECT * CreditAccounts) ; Save above solution query as DebitCredit, both for Model-I and Model-II (7) Find out the list of accounts which have been debited but not credited ( Model-I ) DISTINCT Debit As Code vouchers Debit NOT IN ( SELECT Code DebitCredit) ; ( Model-II ) SELECT * DebitAccounts Code NOT IN (SELECT * DebitCredit) (8) Find out the list of accounts which have been credited but not debited (Model-I) SELECT DISTINCT Credit As Code vouchers Credit NOT IN ( SELECT Code DebitCredit) ; (Model-II) SELECT * CreditAccounts Code NOT IN ( SELECT * DebitCredit)

Still stuck on this lesson?

Get an AI answer grounded in your actual textbook — with the exact page reference.

Ask AI about this topic →