SlideShare ist ein Scribd-Unternehmen logo
1 von 9
/*******************************************************************
POS 410
Learning Team A



Final Project

March 19,2012
********************************************************************/

/********************************************************************

     The following code will create the database for team A


********************************************************************/

CREATE DATABASE KudlerCoATeamA


/********************************************************************

An SQL query that will display all of the database fields.

Picture Ex. POS410TeamA1

********************************************************************/

SELECT * FROM ChartOfAccounts ORDER BY Account ASC




/********************************************************************

Script for Select Top NRows command from SSMS

Picture Ex. POS410TeamA2

********************************************************************/

SELECT TOP 1000 [Account]
      ,[Description]
      ,[ShortDescription]
      ,[F4]
  FROM ChartOfAccounts


/********************************************************************

Use the correct database.

********************************************************************/

USE [KudlerCoATeamA]
GO



/********************************************************************
‱ Create account number query.
‱ Test query.
To make the test efficient, we select which accounts occur more than
once in the table.And then, we use that information for the testing
the balance queries.

Picture Ex. POS410TeamA3

********************************************************************/

SELECT TOP 20 Account, COUNT(*) AS [Occurence] FROM Accounts GROUP BY Account
ORDER BY COUNT(*) DESC;
SELECT TOP 20 Account, COUNT(*) AS [Occurence] FROM Accounts GROUP BY Account
ORDER BY COUNT(*) DESC;




/********************************************************************

A test of the database by means of a query by account number and
a report totaling the balance field test data entered by the
database design team. The query will display all fields (description,
short description, and balance) using the account number as the
key to the query.

Test Account numbers used:
430001
430002
430003
430004
430005
430006
430007
430008
430009
430010
430011
430012
430013
430014
430015
430016
430017
430101
430102
430103
113001
113000
112001
112000
111001
111000
100042
100041
100040
100032
100031
100030
100022
100021
100020
100012
100011
100010
100003
100002

The Total Balance is included as a field in the result set.

Picture Ex. POS410TeamA4


********************************************************************/

SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430001)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430001;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430002)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430002;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430003)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430003;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430004)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430004;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430005)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430005;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430006)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430006;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430007)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430007;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430008)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430008;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430009)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430009;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430010)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430010;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430011)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430011;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430012)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430012;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430013)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430013;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430101)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430101;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430102)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430102;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430103)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=430103;

SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=113001)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=113001;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=113000)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=113000;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=112001)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=112001;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=112000)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=112000;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=111001)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=111001;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=111000)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=111000;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100042)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100042;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100041)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100041;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100040)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100040;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100032)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100032;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100031)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100031;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100030)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100030;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100022)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100022;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100021)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100021;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100020)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100020;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100012)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100012;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100011)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100011;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100010)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100010;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100003)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100003;
SELECT   *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100002)   as
[Total   Balance] FROM ChartOfAccounts WHERE Account=100002;

/********************************************************************

Use the correct database.

********************************************************************/

USE [KudlerCoATeamA]
GO




/********************************************************************

This report uses the Account number as the key to the query.
The sum for the query is at the bottom of each query.

Test Account numbers used:
430001
430002
430003
430004
430005
430006
430007
430008
430009
430010
430011
430012
430013
430014
430015
430016
430017
430101
430102
430103
113001
113000
112001
112000
111001
111000
100042
100041
100040
100032
100031
100030
100022
100021
100020
100012
100011
100010
100003
100002

Picture Ex. POS410TeamA5


********************************************************************/

SELECT * FROM ChartOfAccounts WHERE Account=430001
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430002
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430003
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430004
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430005
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430006
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430007
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430008
    ORDER BY Account
COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430009
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430010
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430011
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430012
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430013
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430014
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430015
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430016
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430017
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430101
    ORDER BY Account
        COMPUTE SUM(Balance);
SELECT * FROM ChartOfAccounts WHERE Account=430102
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=430103
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=113001
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=113000
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=112001
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=112000
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=111001
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=111000
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100042
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100041
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100040
    ORDER BY Account
        COMPUTE SUM(Balance);
SELECT * FROM ChartOfAccounts WHERE Account=100032
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100031
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100030
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100022
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100021
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100020
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100012
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100011
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100010
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100003
    ORDER BY Account
        COMPUTE SUM(Balance);



SELECT * FROM ChartOfAccounts WHERE Account=100002
    ORDER BY Account
COMPUTE SUM(Balance);




********************************************************************

Use the correct database.

********************************************************************/

USE [KudlerCoATeamA]
GO


********************************************************************

The report will display all fields with a break based on the first
two digits of the account number and subtotal of the balance field
at each break. A grand total of the balance field will be provided
at the end of the report.

********************************************************************/

SELECT *
      FROM ChartOfAccounts
            ORDER BY LEFT(Account, 2), Account
                  COMPUTE SUM(Balance) BY LEFT(Account, 2)
                  COMPUTE SUM(Balance);

Weitere Àhnliche Inhalte

Andere mochten auch

Bedlibrary
BedlibraryBedlibrary
Bedlibrary
Janecatalla
 
Jane catalla
Jane catallaJane catalla
Jane catalla
Janecatalla
 
Bedlibrary2
Bedlibrary2Bedlibrary2
Bedlibrary2
Janecatalla
 
Presentasi Journal Review-Manajemen Pemasaran
Presentasi Journal Review-Manajemen PemasaranPresentasi Journal Review-Manajemen Pemasaran
Presentasi Journal Review-Manajemen Pemasaran
Putri Imoet
 
Relationships within the relational database
Relationships within the relational databaseRelationships within the relational database
Relationships within the relational database
Janecatalla
 

Andere mochten auch (13)

Bedlibrary
BedlibraryBedlibrary
Bedlibrary
 
XSD Incomplete Overview Draft
XSD Incomplete Overview DraftXSD Incomplete Overview Draft
XSD Incomplete Overview Draft
 
Tattoo img
Tattoo imgTattoo img
Tattoo img
 
Jane catalla
Jane catallaJane catalla
Jane catalla
 
Bedlibrary2
Bedlibrary2Bedlibrary2
Bedlibrary2
 
Economia IC part B
Economia IC part BEconomia IC part B
Economia IC part B
 
Lis124
Lis124Lis124
Lis124
 
Validation of a credit card number
Validation of a credit card numberValidation of a credit card number
Validation of a credit card number
 
Presentasi Journal Review-Manajemen Pemasaran
Presentasi Journal Review-Manajemen PemasaranPresentasi Journal Review-Manajemen Pemasaran
Presentasi Journal Review-Manajemen Pemasaran
 
Relationships within the relational database
Relationships within the relational databaseRelationships within the relational database
Relationships within the relational database
 
IP Multicast Routing
IP Multicast RoutingIP Multicast Routing
IP Multicast Routing
 
Basic java tutorial
Basic java tutorialBasic java tutorial
Basic java tutorial
 
SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3SQL302 Intermediate SQL Workshop 3
SQL302 Intermediate SQL Workshop 3
 

KĂŒrzlich hochgeladen

THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
Faga1939
 
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
hyt3577
 
The political system of the united kingdom
The political system of the united kingdomThe political system of the united kingdom
The political system of the united kingdom
lunadelior
 
call girls inMahavir Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls inMahavir Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7call girls inMahavir Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls inMahavir Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

KĂŒrzlich hochgeladen (20)

Unveiling the Characteristics of Political Institutions_ A Comprehensive Anal...
Unveiling the Characteristics of Political Institutions_ A Comprehensive Anal...Unveiling the Characteristics of Political Institutions_ A Comprehensive Anal...
Unveiling the Characteristics of Political Institutions_ A Comprehensive Anal...
 
04052024_First India Newspaper Jaipur.pdf
04052024_First India Newspaper Jaipur.pdf04052024_First India Newspaper Jaipur.pdf
04052024_First India Newspaper Jaipur.pdf
 
05052024_First India Newspaper Jaipur.pdf
05052024_First India Newspaper Jaipur.pdf05052024_First India Newspaper Jaipur.pdf
05052024_First India Newspaper Jaipur.pdf
 
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
 
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
 
declarationleaders_sd_re_greens_theleft_5.pdf
declarationleaders_sd_re_greens_theleft_5.pdfdeclarationleaders_sd_re_greens_theleft_5.pdf
declarationleaders_sd_re_greens_theleft_5.pdf
 
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
 
The political system of the united kingdom
The political system of the united kingdomThe political system of the united kingdom
The political system of the united kingdom
 
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
 
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
 
call girls inMahavir Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls inMahavir Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7call girls inMahavir Nagar  (delhi) call me [🔝9953056974🔝] escort service 24X7
call girls inMahavir Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
422524114-Patriarchy-Kamla-Bhasin gg.pdf
422524114-Patriarchy-Kamla-Bhasin gg.pdf422524114-Patriarchy-Kamla-Bhasin gg.pdf
422524114-Patriarchy-Kamla-Bhasin gg.pdf
 
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
 
China's soft power in 21st century .pptx
China's soft power in 21st century   .pptxChina's soft power in 21st century   .pptx
China's soft power in 21st century .pptx
 
06052024_First India Newspaper Jaipur.pdf
06052024_First India Newspaper Jaipur.pdf06052024_First India Newspaper Jaipur.pdf
06052024_First India Newspaper Jaipur.pdf
 
Job-OriДntДd Courses That Will Boost Your Career in 2024
Job-OriДntДd Courses That Will Boost Your Career in 2024Job-OriДntДd Courses That Will Boost Your Career in 2024
Job-OriДntДd Courses That Will Boost Your Career in 2024
 
10052024_First India Newspaper Jaipur.pdf
10052024_First India Newspaper Jaipur.pdf10052024_First India Newspaper Jaipur.pdf
10052024_First India Newspaper Jaipur.pdf
 
Politician uddhav thackeray biography- Full Details
Politician uddhav thackeray biography- Full DetailsPolitician uddhav thackeray biography- Full Details
Politician uddhav thackeray biography- Full Details
 
Dubai Call Girls Pinky O525547819 Call Girl's In Dubai
Dubai Call Girls Pinky O525547819 Call Girl's In DubaiDubai Call Girls Pinky O525547819 Call Girl's In Dubai
Dubai Call Girls Pinky O525547819 Call Girl's In Dubai
 
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
 

POS410 Team Final

  • 1. /******************************************************************* POS 410 Learning Team A Final Project March 19,2012 ********************************************************************/ /******************************************************************** The following code will create the database for team A ********************************************************************/ CREATE DATABASE KudlerCoATeamA /******************************************************************** An SQL query that will display all of the database fields. Picture Ex. POS410TeamA1 ********************************************************************/ SELECT * FROM ChartOfAccounts ORDER BY Account ASC /******************************************************************** Script for Select Top NRows command from SSMS Picture Ex. POS410TeamA2 ********************************************************************/ SELECT TOP 1000 [Account] ,[Description] ,[ShortDescription] ,[F4] FROM ChartOfAccounts /******************************************************************** Use the correct database. ********************************************************************/ USE [KudlerCoATeamA] GO /******************************************************************** ‱ Create account number query. ‱ Test query.
  • 2. To make the test efficient, we select which accounts occur more than once in the table.And then, we use that information for the testing the balance queries. Picture Ex. POS410TeamA3 ********************************************************************/ SELECT TOP 20 Account, COUNT(*) AS [Occurence] FROM Accounts GROUP BY Account ORDER BY COUNT(*) DESC; SELECT TOP 20 Account, COUNT(*) AS [Occurence] FROM Accounts GROUP BY Account ORDER BY COUNT(*) DESC; /******************************************************************** A test of the database by means of a query by account number and a report totaling the balance field test data entered by the database design team. The query will display all fields (description, short description, and balance) using the account number as the key to the query. Test Account numbers used: 430001 430002 430003 430004 430005 430006 430007 430008 430009 430010 430011 430012 430013 430014 430015 430016 430017 430101 430102 430103 113001 113000 112001 112000 111001 111000 100042 100041 100040 100032 100031 100030 100022 100021 100020 100012 100011 100010
  • 3. 100003 100002 The Total Balance is included as a field in the result set. Picture Ex. POS410TeamA4 ********************************************************************/ SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430001) as [Total Balance] FROM ChartOfAccounts WHERE Account=430001; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430002) as [Total Balance] FROM ChartOfAccounts WHERE Account=430002; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430003) as [Total Balance] FROM ChartOfAccounts WHERE Account=430003; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430004) as [Total Balance] FROM ChartOfAccounts WHERE Account=430004; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430005) as [Total Balance] FROM ChartOfAccounts WHERE Account=430005; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430006) as [Total Balance] FROM ChartOfAccounts WHERE Account=430006; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430007) as [Total Balance] FROM ChartOfAccounts WHERE Account=430007; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430008) as [Total Balance] FROM ChartOfAccounts WHERE Account=430008; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430009) as [Total Balance] FROM ChartOfAccounts WHERE Account=430009; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430010) as [Total Balance] FROM ChartOfAccounts WHERE Account=430010; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430011) as [Total Balance] FROM ChartOfAccounts WHERE Account=430011; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430012) as [Total Balance] FROM ChartOfAccounts WHERE Account=430012; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430013) as [Total Balance] FROM ChartOfAccounts WHERE Account=430013; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430101) as [Total Balance] FROM ChartOfAccounts WHERE Account=430101; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430102) as [Total Balance] FROM ChartOfAccounts WHERE Account=430102; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=430103) as [Total Balance] FROM ChartOfAccounts WHERE Account=430103; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=113001) as [Total Balance] FROM ChartOfAccounts WHERE Account=113001; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=113000) as [Total Balance] FROM ChartOfAccounts WHERE Account=113000; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=112001) as [Total Balance] FROM ChartOfAccounts WHERE Account=112001; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=112000) as [Total Balance] FROM ChartOfAccounts WHERE Account=112000; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=111001) as [Total Balance] FROM ChartOfAccounts WHERE Account=111001; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=111000) as [Total Balance] FROM ChartOfAccounts WHERE Account=111000; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100042) as [Total Balance] FROM ChartOfAccounts WHERE Account=100042; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100041) as [Total Balance] FROM ChartOfAccounts WHERE Account=100041; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100040) as [Total Balance] FROM ChartOfAccounts WHERE Account=100040; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100032) as [Total Balance] FROM ChartOfAccounts WHERE Account=100032; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100031) as
  • 4. [Total Balance] FROM ChartOfAccounts WHERE Account=100031; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100030) as [Total Balance] FROM ChartOfAccounts WHERE Account=100030; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100022) as [Total Balance] FROM ChartOfAccounts WHERE Account=100022; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100021) as [Total Balance] FROM ChartOfAccounts WHERE Account=100021; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100020) as [Total Balance] FROM ChartOfAccounts WHERE Account=100020; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100012) as [Total Balance] FROM ChartOfAccounts WHERE Account=100012; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100011) as [Total Balance] FROM ChartOfAccounts WHERE Account=100011; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100010) as [Total Balance] FROM ChartOfAccounts WHERE Account=100010; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100003) as [Total Balance] FROM ChartOfAccounts WHERE Account=100003; SELECT *, (SELECT SUM(Balance)FROM ChartOfAccounts WHERE Account=100002) as [Total Balance] FROM ChartOfAccounts WHERE Account=100002; /******************************************************************** Use the correct database. ********************************************************************/ USE [KudlerCoATeamA] GO /******************************************************************** This report uses the Account number as the key to the query. The sum for the query is at the bottom of each query. Test Account numbers used: 430001 430002 430003 430004 430005 430006 430007 430008 430009 430010 430011 430012 430013 430014 430015 430016 430017 430101 430102 430103 113001 113000 112001 112000 111001 111000
  • 5. 100042 100041 100040 100032 100031 100030 100022 100021 100020 100012 100011 100010 100003 100002 Picture Ex. POS410TeamA5 ********************************************************************/ SELECT * FROM ChartOfAccounts WHERE Account=430001 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430002 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430003 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430004 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430005 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430006 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430007 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430008 ORDER BY Account
  • 6. COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430009 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430010 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430011 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430012 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430013 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430014 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430015 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430016 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430017 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430101 ORDER BY Account COMPUTE SUM(Balance);
  • 7. SELECT * FROM ChartOfAccounts WHERE Account=430102 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=430103 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=113001 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=113000 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=112001 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=112000 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=111001 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=111000 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100042 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100041 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100040 ORDER BY Account COMPUTE SUM(Balance);
  • 8. SELECT * FROM ChartOfAccounts WHERE Account=100032 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100031 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100030 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100022 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100021 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100020 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100012 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100011 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100010 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100003 ORDER BY Account COMPUTE SUM(Balance); SELECT * FROM ChartOfAccounts WHERE Account=100002 ORDER BY Account
  • 9. COMPUTE SUM(Balance); ******************************************************************** Use the correct database. ********************************************************************/ USE [KudlerCoATeamA] GO ******************************************************************** The report will display all fields with a break based on the first two digits of the account number and subtotal of the balance field at each break. A grand total of the balance field will be provided at the end of the report. ********************************************************************/ SELECT * FROM ChartOfAccounts ORDER BY LEFT(Account, 2), Account COMPUTE SUM(Balance) BY LEFT(Account, 2) COMPUTE SUM(Balance);