This homework is to practice database queries using SQL. The database used is EmployeesDB, within which...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
This homework is to practice database queries using SQL. The database used is EmployeesDB, within which the table Employees will be used. (This DB has only one table) Employees EmplD Last Name First Name Position Department Shift Salary Hire Date When a field name has two parts, that field name must be in a pair of bracket. Compare: Emel [Last Name] Department [Hire Date] Those fields having a two-part name need brackets [..] Sample of positions & dept names (so you know how to type those names) Position Department IIMIMIT Accountant Product Marketer Engineer Admin Assist Design Specialist Inventory Accounting Marketing Engineering Admin Art D Warehouse Chief Scientist R and D Group Admin Assist R and D Write the SQL codes for the stated business logic (scenarios/needs). Every question has two scenarios, each for a group of students: A~G is group 1, and H~Z is group 2. Data types: DEPT-Text; LastName-Text, Shift - Number, the others are obvious. When specifying a condition, if the condition includes a number, type that number condition directly, if the condition includes a text, that text condition must be in a pair of quotes, such as "R and D". 3 points Problem 1: Projection (display subset of columns) and Selection (display subset of rows) List last name, first name, department, and salary, (Group 1, A-G) for the Admin department, order by position, then w/in a position order by last name; (Group 2, H~Z) for the R and D department, order by position, then w/in a position order by salary. Problem 2: Combination of criteria with AND (the two conditions must be SIMULTANEOUSLY satisfied) List employees' last name, first name, department, and salary, 3 points (Group 1, A-G) for those in Marketing department, whose salary is $40,000 or more: (Group 2, H^Z) for those in R and D department, whose salary is $50,000 or less. Problem 3: Combination of criteria with AND 300 OR (watch the logic; carefully determine whether or not to use parentheses, and *if* using, where to use). List last name, first name, department, and salary, for (Group 1, A-G) the Accounting department, or those employees in Shift 3whose salary is below 4 points $20,000; for (Group 2, HZ) the R and D department, or those employees whose salary is more than $70,000 and position is Engineer. 4 points Problem 4: GROUP BY, with ORDER BY (Two prints) (Group 1, A-G) Print 1: List average salary for each department: Print 2: List average salary for each department, order the output by the average salary, high to low. (Group 2, H~Z) Print 1: List the number of employees (COUNT last name) for each department: Print 2: List the number of employees (COUNT last name) for each department, order the output by the number of employees, high to low. This homework is to practice database queries using SQL. The database used is EmployeesDB, within which the table Employees will be used. (This DB has only one table) Employees EmplD Last Name First Name Position Department Shift Salary Hire Date When a field name has two parts, that field name must be in a pair of bracket. Compare: Emel [Last Name] Department [Hire Date] Those fields having a two-part name need brackets [..] Sample of positions & dept names (so you know how to type those names) Position Department IIMIMIT Accountant Product Marketer Engineer Admin Assist Design Specialist Inventory Accounting Marketing Engineering Admin Art D Warehouse Chief Scientist R and D Group Admin Assist R and D Write the SQL codes for the stated business logic (scenarios/needs). Every question has two scenarios, each for a group of students: A~G is group 1, and H~Z is group 2. Data types: DEPT-Text; LastName-Text, Shift - Number, the others are obvious. When specifying a condition, if the condition includes a number, type that number condition directly, if the condition includes a text, that text condition must be in a pair of quotes, such as "R and D". 3 points Problem 1: Projection (display subset of columns) and Selection (display subset of rows) List last name, first name, department, and salary, (Group 1, A-G) for the Admin department, order by position, then w/in a position order by last name; (Group 2, H~Z) for the R and D department, order by position, then w/in a position order by salary. Problem 2: Combination of criteria with AND (the two conditions must be SIMULTANEOUSLY satisfied) List employees' last name, first name, department, and salary, 3 points (Group 1, A-G) for those in Marketing department, whose salary is $40,000 or more: (Group 2, H^Z) for those in R and D department, whose salary is $50,000 or less. Problem 3: Combination of criteria with AND 300 OR (watch the logic; carefully determine whether or not to use parentheses, and *if* using, where to use). List last name, first name, department, and salary, for (Group 1, A-G) the Accounting department, or those employees in Shift 3whose salary is below 4 points $20,000; for (Group 2, HZ) the R and D department, or those employees whose salary is more than $70,000 and position is Engineer. 4 points Problem 4: GROUP BY, with ORDER BY (Two prints) (Group 1, A-G) Print 1: List average salary for each department: Print 2: List average salary for each department, order the output by the average salary, high to low. (Group 2, H~Z) Print 1: List the number of employees (COUNT last name) for each department: Print 2: List the number of employees (COUNT last name) for each department, order the output by the number of employees, high to low.
Expert Answer:
Answer rating: 100% (QA)
Problem 1 SQL Query SELECT lastName firstName dept salary ... View the full answer
Related Book For
Concepts of Database Management
ISBN: 978-1285427102
8th edition
Authors: Philip J. Pratt, Mary Z. Last
Posted Date:
Students also viewed these databases questions
-
How can advances in technology, such as mobile health applications, wearable devices, and virtual reality simulations, be leveraged to enhance the accessibility, scalability, and effectiveness of...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Read the case study "Southwest Airlines," found in Part 2 of your textbook. Review the "Guide to Case Analysis" found on pp. CA1 - CA11 of your textbook. (This guide follows the last case in the...
-
A fruit vendor professes to sell fruits at the cost price, but uses false weights. He gains 40% in this manner. What weight does he substitute for one kilogram?
-
Fig. 3.90 illustrates plane figures made of thin conductors which are located in a uniform magnetic field directed away from a reader beyond the plane of the drawing. The magnetic induction starts...
-
What are the key principles underlying enzyme catalysis, and how do enzyme structures contribute to their remarkable specificity and efficiency in biochemical reactions ?
-
What are the primary advantages of HR portals and shared-services centers? Give examples of how HR professionals might use each to better achieve cost controls and service enhancement.
-
In Figure, we must apply a force of magnitude 80 N to hold the block stationary at x = 2.0 cm. From that position, we then slowly move the block so that our force does + 4.0 J of work on the...
-
The predicted cash flow for next year by Goodrade Enterprises will be $2.14 Million. The cash flows are anticipated to maintain a growth rate of 7.25% forever. If the required return is 10%, what is...
-
1. Given the facts of the case, what communications do you believe Forrester & Loomis should have made with the audit committee with regard to the transactions with the vendor to comply with PCAOB AS...
-
A simplified model of a passenger car travelling over a road and vibrating in the vertical direction is shown below. The mass of the vehicle is 1000 kg, the spring stiffness of the suspension system...
-
Explain how prices and inflation affect exchange rates in the long run.
-
Explain asymmetric information, the problems it causes, and solutions to these problems.
-
There are two types of diversification: a. Hedging, in which investors reduce idiosyncratic risk by making investments with offsetting payoff patterns. b. Spreading, in which investors reduce...
-
In a sequence of nine steps between December 2015 and December 2018, the Federal Reserve increased its policy interest rate target range by 2.25 percentage points from a historically low level of...
-
Describe a commercial banks assets and liabilities.
-
Which of the following statements are true regarding CI/CD? Group of answer choices Continuous delivery usually means a developer's changes to anapplication are automatically bug tested and uploaded...
-
Write an essay describing the differing approaches of nursing leaders and managers to issues in practice. To complete this assignment, do the following: 1. Select an issue from the following list:...
-
Describe the purpose of the SELECT command in relational algebra.
-
Answer each of the following questions using the TAL Distributors data shown in Figure 1-5. No computer work is required. 1. List the names of all customers that have a credit limit that is less than...
-
What does it mean when a data warehouse is nonvolatile?
-
Name three or more branches of Earth science, and describe the focus of each.
-
How does seafloor spreading relate to continental drift?
-
Describe how tectonic plates move in terms of speed and direction.
Study smarter with the SolutionInn App