Question

In: Computer Science

Part (a) CREATE TWO TABLES IN MICROSOFT ACCESS: (1) A Customer Table which includes the following...

Part (a) CREATE TWO TABLES IN MICROSOFT ACCESS: (1) A Customer Table which includes the following fields: Customer Name, Customer Address, and Credit Limit. (Note: All customers have a $40,000 credit limit). (2) A Sales Invoice table which includes the following fields: Customer Name, Salesperson, Date of Sale, Invoice Number, Amount of Sale. Part (b): Run the following queries: Query 1: List all sales between 10/20/2014 and 11/20/2014 that were greater than $2,500. Include in your query the customer name, date of sale, invoice number, and amount of sale. List the sales in alphabetical order by customer name. Query 2: List total sales by each salesperson for October and November 2014 in descending order. Include in your query the salesperson name and amount of total sales. Query 3: List the total sales by customer in descending order. Include in your query the customer name, customer address, and amount of total sales per customer. Query 4: List the remaining credit available for each customer. Include in your query the customer name, customer address, credit limit, amount of total sales per customer, and remaining credit available for each customer in descending order of remaining credit available.

Solutions

Expert Solution

Dear Student ,

As per the requirement submitted above , kindly find the below solution.

1.Table Name :Customer

2.Table Name :SalesInvoice

Query 1:

SELECT CustomerName,DateOfSale,invoiceNumber,amountOfSale
FROM SalesInvoice
where DateofSale between ('10/20/2014') and ('11/20/2014') and
amountOfSale >2500
order by CustomerName;

Explanation :

  • Given SQL query above will find the CustomerName, DateOfSale, invoiceNumber, amountOfSale from SalesInvoice

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

Query 2 :

SELECT Salesperson,sum(AmountOfSale)
FROM SalesInvoice
where DateofSale between ('10/01/2014') and ('11/30/2014')
group by Salesperson
order by sum(AmountOfSale) desc;

Explanation :

  • This sql query will group all sales amount in oct and nov by sales person and will return the result.

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

Query 3:

SELECT SalesInvoice.CustomerName, CustomerAddress,sum(AmountOfSale) as 'amount of total sales'
FROM Customer inner join SalesInvoice
on
Customer.CustomerName=SalesInvoice.CustomerName
group by SalesInvoice.CustomerName,CustomerAddress
order by sum(AmountOfSale) desc;

Explanation :

  • SQL Query above will join two tables customer and Salesinvoice based on customerName
  • and will group the records based on customerName

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

Query 4:

SELECT SalesInvoice.CustomerName, CustomerAddress,creditLimit,sum(AmountOfSale) as 'amount of total sales',creditLimit-sum(AmountOfSale) as ' credit available'
FROM Customer inner join SalesInvoice
on
Customer.CustomerName=SalesInvoice.CustomerName
group by SalesInvoice.CustomerName,CustomerAddress,creditLimit
order by creditLimit-sum(AmountOfSale) desc;

Explanation :

  • SQL query above will join two tables customer and salesinvoice and will return the details.

NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.


Related Solutions

Create a query in Access that uses two tables, the Patient table and the Session table. Add
Create a query in Access that uses two tables, the Patient table and the Session table. Add the LastName, FirstName, and SessionDate fields to the query grid. Run the query. How many records are displayed? Delete the join line between the field lists in Query Design View. Rerun the query. How many records are now displayed? Why are the results different? You do not need to save the queries. 
1. write SQL statements to create the following two tables: a) Department table that contains the...
1. write SQL statements to create the following two tables: a) Department table that contains the following columns(dept_no,deptname,location) set the deptno to be the primary key. b) Employee table contains the following columns(emp_no,empname,deptno,salary)set the emp_no to be the primary key and dept_no to be the foreign key. 2. Write SQL statements to Insert the following 3 rows in Employee table:        (101,’Sami’,’D-101’,5000)        (102,’Yousef’,’D-101’,4000)        (103,’Sami’,’D-102’,7000) 3. Write SQL statements to Insert the following 3 rows in Department table:       ...
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId           &nb
Tables: Create table Item(    &nbs... Bookmark Tables: Create table Item(                 ItemId                 char(5) constraint itmid_unique primary key,                 Decription           varchar2(30),                 Unitcost               number(7,2)); Create table Customer(                 custID                   char(5) constraint cid.unique primary key,                 custName          varchar2(20),                 address                                varchar2(50)); Create table Orderdata( orderID                char(5) constraint oid_uniq primary key,                 orderdate           date,                 shipdate              date,                 ItemId                  char(5) references Item.ItemId,                 No_of_items     number(4),                 Unitcost               number(7,2),                 Order_total        number(7,2),                 custID                   char(5) references customer.custID); Insert Into Item values(‘A123’,’Pencil’,2.5);...
Using the table function in a Microsoft Word Document, create a table which compares and contrasts...
Using the table function in a Microsoft Word Document, create a table which compares and contrasts the following payments systems: 1. RBRVS 2. RUG’S 3. APC’s Include in your comparison include at least the following elements Classification system(s) used (ICD-10-CM, ICD-10-PCS, CPT, etc.) Health care setting (Inpatient, outpatient, physician office, etc.). Examples of who uses the payment system (Medicare, Medicaid, commercial payers, etc.) Examples of data that is required for the payment system (principle diagnosis, principle procedure, discharge disposition, etc.)
1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold)....
1. Write CREATE TABLE statements for the following tables (foreign keys are in italic and bold). Make sure you have all needed constraints and appropriate datatypes for attributes: Student (stID, stName, dateOfBirth, advID, majorName, GPA) Advisor (advID, advName, specialty) 2.  Insert several records in each table.
Instructions: Create a two by two table with correct labels, appropriate numbers and title in Microsoft...
Instructions: Create a two by two table with correct labels, appropriate numbers and title in Microsoft Excel with the information listed below and post in Microsoft Word (1 point): Title: Table 1 – Baseline characteristics of participants by prospective development of gestational diabetes: 72 Chinese women with a family history of gestational diabetes: 1013 Chinese women without a family history of gestational diabetes: 19 Chinese women with a family history of gestational diabetes who developed gestational diabetes: 136 Chinese women...
QUESTION 1 For the salesdb tables loaded in your environment, the table specifications are below: CUSTOMER...
QUESTION 1 For the salesdb tables loaded in your environment, the table specifications are below: CUSTOMER (custno, lname, fname, mname, email, mobile, addrln1, addrln2, addrln3, city, state, zip, status) PRODUCT (prodno, sku, unit, long_desc, short_desc, unitprice, qty_on_hand, qty_on_order) SALES (salesno, saledate, custno, prodno, salesqty, unitprice, lineamount, taxable, taxrate, discountrate) Write SQL that will list the sales to custno=11, Eva Santis. The resultset should include: custno, fname, lname, salesno, prodno, long_desc, product unitprice, salesqty, totalcost for each line item. Test your...
Please use an Access database with two tables to answer the following: use an example to...
Please use an Access database with two tables to answer the following: use an example to discuss the difference between a right, left, and inner join. Next, perform the left joint, right joint, and inner joint all on the each of the two tables.
1. The purpose(s) of the U.S. The Constitution includes which of the following: a. create three...
1. The purpose(s) of the U.S. The Constitution includes which of the following: a. create three coequal branches of the federal government. b. delegate and enumerate the powers of each of the federal branches of government. C. provide procedural protections to businesses, citizens, and persons from government interference. d. All of the answer choices are correct. 2. The power of Congress to regulate commerce comes from……,,,, a. states' legislatures. the U.S. Constitution's Commerce Clause. b. the U.S. President's executive orders...
Table Rock Tables, manufactures two popular tables, a country style table and a contemporary style table....
Table Rock Tables, manufactures two popular tables, a country style table and a contemporary style table. The manufacturing process for both tables requires the use of three types of machines. The time to produce the tables on each machine given in the following table: Machine   Country Table Contemporary Table Total Time Available Router 1.5 2 1000 Sander 3.0 4.5 2000 Polisher 2.5 1.5 1500 The earns a profit of $350 on the Country table, and $450 on the Contemporary table....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT