Computer Science Homework Solutions
Problem
#135080

Create a query that would convert the order year into a decade and count the orders

Using the database attached to Lecture 2, let's say you are interested (let's say as the business owner) to see how old the books are that people order (going by their publication date).

  First, you'd need to create a query that would convert the order year into a decade and count the orders:

   SELECT books.title, CInt(Left([publication_year],3))*10 AS DECADE, order_lines.quantity
   FROM books INNER JOIN order_lines ON books.isbn = order_lines.isbn;


    ...The function "CInt() converts text values into integers (year is stored as a text value).

    Anyhow, for participation credit, cut and paste the above SQL into a query in the Lecture 2 database. Name the query BOOK_DECADE.

    Then, create the cross tab query following these steps:
    in the queries TAB click: New
    then Cross Tab query wizard
    then OK
    In "View", click "Queries" and then Select query BOOK_DECADE and click NEXT
    Add the TITLE to "Selected Field and click NEXT
    Highlight DECADE and click NEXT
    UNCLICK "Yes, include row sums"
    Click Quantity under "Fields:" and click "Sum" under "Functions:" and click NEXT
    Then click FINISH        

    When you are done, cut and paste the SQL (for this query) and paste into a word document.

Attached file(s):
Attachments
WEEK2_ACCESS2000.mdb  View File
Solution
What is this?
By OTA - Overall OTA Rating
Purchase Cost Now
$2.19 CAD (was ~$7.98)
Included in Download
  • Plain text response
$2.19 Instant Download
Add to Cart
Why you can trust BrainMass.com
  • Your Information is Secure
  • Best Online Academic Help Service
  • Students find real academic Success
Related Solutions
  • Query Results - RIGHT Outer Join - Using the week 2 lecture database, if you wanted to see all the isbns from the books table and any matching isbns from the order_lines table, you'd want to do an outer join as such (because not every ...
  • PQ #1 - I have a query that starts with the line: SELECT books.isbn, order_lines.isbn ...why would I want to see isbns from two different tables? What sort of query would warrant that - an inne ...
  • Running a Query - Why wont this query run and how would you write it correctly? Major hint: try and run the query (use the database attached to Week 2's lecture) ... you'll get an error message that should explain: ...
  • Author and tittles - Using the week 2 lecture/homework database, show the author and titles of books that have never sold. Here is the SQL for my question, but what are the author and titles of the books that did not s ...
  • Access 2000 Database - Use the attached WEEK2_ACCESS2000.mdb database I just need the SQL code, which can be cut and pasted into a word document. 1. Perform an inner join between the BOOKS table and the ORDER_LINE ...
Browse