StudentShare
Contact Us
Sign In / Sign Up for FREE
Search
Go to advanced search...
Free

Advanced SQL Queries for the Pine Valley Furniture Company Database - Term Paper Example

Cite this document
Summary
The author determines the IDs for all orders that include furniture produced by the product line 1, lists the details about the product with the lowest standard price. The author also identifies how many different items were ordered on order number 1006…
Download full paper File format: .doc, available for editing
GRAB THE BEST PAPER94.8% of users find it useful
Advanced SQL Queries for the Pine Valley Furniture Company Database
Read Text Preview

Extract of sample "Advanced SQL Queries for the Pine Valley Furniture Company Database"

Advanced SQL Queries for the Pine Valley Furniture Company DatabaseQuestion 1: What are the IDs for all orders that include furniture produced by the product line 1?SELECT ORDER_t.Order_ID, PRODUCT_LINE_t.Product_Line_IDFROM ORDER_t, PRODUCT_LINE_tWHERE (((PRODUCT_LINE_t.Product_Line_ID)=1));In order to make this query, we need to know which entities or tables we will query. We need the IDs of all the orders that were made on all the furniture processed by product line one. The most important table in this case is the ORDER table, which we know as ORDER_t.

The field from this table that identifies the orders for us is the Order_ID. Given, we need the other table, which has information on product lines. This is the Product_Line table. From this table, we need to query the field that identifies all the product lines for us. It is the Product_Line_ID. We then specify which product line we need to use. This is the product line one. Hence, we have the SQL query above.Question 2: List the details about the product with the lowest standard price.SELECT TOP 1PRODUCT_t.

Product_ID,PRODUCT_t.Product_Description, PRODUCT_t.Product_Finish, PRODUCT_t.Standard_Price, PRODUCT_t.Product_Line_IDFROM PRODUCT_tGROUP BY PRODUCT_t.Product_ID, PRODUCT_t.Product_Description, PRODUCT_t.Product_Finish, PRODUCT_t.Standard_Price, PRODUCT_t.Product_Line_IDORDER BY Min(PRODUCT_t.Standard_Price);In this query, we need to come up with the list of the products that has the lowest price. To get the result, we need to sort the prices of the products and choose the one that is the least among them all.

In the parameters for the queries, we indicate that we would like to pick the top item from the field whose values have been sorted in ascending order. From then on, we display the top 1 item to show us the least item in terms of the price.Question 3: List the employee ID, name, and his/her work center ID for all employeesSELECT EMPLOYEE_t.Employee_ID, EMPLOYEE_t.Employee_Name, WORK_CENTER.Work_Center_IDFROM EMPLOYEE_t, WORK_CENTER;This query is obtained from the employee table and the work center table.

From the employee table we get the employee identifications and the names of the employees. The work center table is only meant to give us the work center identifications for the employees. Once we get the values from both of the tables, we make the query.Question 4: How many different items were ordered on order number 1006?SELECT Order_line_t.Order_ID, Order_line_t.Product_IDFROM Order_line_tWHERE (((Order_line_t.Order_ID)=1006));The above query is made on the order line table of the database.

This table contains both the order ids as well as the product identification numbers. In order to know which different products are contained in the order number 1006, we design the query in such a way that we display the order ids for all the product lines while indicating the product line number 1006 as the only restriction on the query.Question 5: Give 10% discount to all the products manufactured by the product line 3SELECT PRODUCT_LINE_t.Product_Line_ID, PRODUCT_t.Standard_Price, PRODUCT_t.

Product_Description, PRODUCT_t.Product_ID, PRODUCT_t.Standard_Price*0.9 AS Discounted_PriceFROM PRODUCT_LINE_t INNER JOIN PRODUCT_t ON PRODUCT_LINE_t.Product_Line_ID = PRODUCT_t.Product_Line_IDWHERE (((PRODUCT_LINE_t.Product_Line_ID)=3));In order to know the discounted product prices for the products manufactured by the product line 3, we need to calculate the discounted prices and display them on a different column. The operands for the calculation are the Standard_Price for all the products, and 0.9. Once the calculation has been done, we display the product details of the products manufactured by line 3.

Works Cited"Chapter 5 Logical Database Design and the Relational Model." e-Portfolio TurgutTezir.N.p., 2006. Web. 2 Mar. 2012 .

Read More
Cite this document
  • APA
  • MLA
  • CHICAGO
(“Advanced SQL Queries for the Pine Valley Furniture Company Database Term Paper”, n.d.)
Retrieved from https://studentshare.org/information-technology/1590544-write-advanced-sql-queries-for-the-pine-valley-furniture-company-database-attached-to-answer-the-following-5-questions
(Advanced SQL Queries for the Pine Valley Furniture Company Database Term Paper)
https://studentshare.org/information-technology/1590544-write-advanced-sql-queries-for-the-pine-valley-furniture-company-database-attached-to-answer-the-following-5-questions.
“Advanced SQL Queries for the Pine Valley Furniture Company Database Term Paper”, n.d. https://studentshare.org/information-technology/1590544-write-advanced-sql-queries-for-the-pine-valley-furniture-company-database-attached-to-answer-the-following-5-questions.
  • Cited: 2 times

CHECK THESE SAMPLES OF Advanced SQL Queries for the Pine Valley Furniture Company Database

Database Architecture and Administration

The aim of this essay is to present an evolutionary history of various database Models over the four decades of their existence.... As the paper declares the navigational Model encompasses the “network model” and “hierarchical model” of database interfaces.... The network model was developed by Charles Bachman in 1971 to define and set a standard for database systems.... Due to these limitations, navigational database models became outdated by 1980s, though a form of the hierarchical model is still used in XML applications....
9 Pages (2250 words) Essay

Distributed Database System Design

A Distributed database System facilitates various applications to have an easy access to the data from local as well as remote databases.... Client-server… rchitecture is used by the Distributed database Systems, whereby the database server is the Oracle software that manages the database, and the client may be an application that requests information from the database server.... Each computer in this network consists of a node which The client can access information by directly or indirectly connecting to the database server....
10 Pages (2500 words) Essay

Database Design of Torrington Freight Rail

Implementation of the database design in Oracle and testing of the design through scenario specific sql queries.... which becomes cumbersome and tiresome to… This aim of this report is to give a detailed description of the design for a relational database specifically proposed to fulfil the TFR data needs.... The relational database system will enable TFR to The report gives a detailed technical description of the systematic formation of the system's data model....
11 Pages (2750 words) Essay

An Analysis of the NoSQL Database Management System

With social graphs, personal user data, machine logging and… For such services to be availed properly, huge amounts of data are processed - a service that traditional database management system could not handle (Pludge & Membrey, 2010).... This title is affiliated to the fact that NoSQL databases do not require execution of SQL statements to query the database.... It was devised by Carlo Strozzi in 1998 while referring to his Light Weight, Open Source database that had no any SQL interface....
6 Pages (1500 words) Essay

Structured Query Language Database

The normalization process will be done in two phases i.... .... First normal form (1NF) and second normal form (2NF). The goal of conforming the… The attributes tours sold repeats itself twice in the initial data model.... The first step will form a new separate table for the tours sold table with the customerId field as the primary key of the customer table and The customerID field is a unique area because each customer will have their unique customerID thus the reason for its use as the primary key....
3 Pages (750 words) Essay

Distributive Database Capabilities Comparison

Definite methods can be employed by BAS to pick up their databases grounds… SQL applications can be enhanced in the BAS Computer using certain tools that can boost the performance of the database employed by Microsoft Corporation.... Other database performance enhancing methodologies usually call for a profile within the system that reports the data obtained and utilized in changing fine directories The Simultaneous multithreading (SMT) processing develops the computer by sustaining cord level parallelism on one superscalar mainframe (Quick Transport Solutions, Inc....
6 Pages (1500 words) Research Paper

The Gain of SQL Optimization in Databases

The paper will discuss the significance of fine tuning sql queries.... This essay analyzes the main strengths of the Relational database Management System, that lies in its user-friendliness and querying capabilities, in lieu of its efficiency related to the hardware or system overhead.... hellip; From this paper, it is clear that the database Management Systems are tuned or optimized so as to improve their performance by making the system run faster....
8 Pages (2000 words) Research Paper

Query Optimisation in Wireless Sensor Networks Database

This review "Query optimisation in wireless sensor networks database" is about the query optimisation is a procedure through which numerous plans for the execution of the query aimed at meeting the requirements of a query are assessed and the plan of the query that is most suitable selected for the execution.... When considering the database, wireless sensor networks (WSN) are taken into contemplation for this paper.... hellip; There exists systems for the management of databases, which control big quantities of the data that can be recovered through stipulating several queries that are articulated in a query language....
7 Pages (1750 words) Literature review
sponsored ads
We use cookies to create the best experience for you. Keep on browsing if you are OK with that, or find out how to manage cookies.
Contact Us