Question

Consider the Goldstar database. Choose the query that will display all of the position titles and...

Consider the Goldstar database. Choose the query that will display all of the position titles and the number of employees that hold that position.

SELECT title, COUNT(ssn) AS TotalEmployees FROM position, employee WHERE position.location_id = employee.position_id GROUP BY title;

SELECT title, SUM(ssn) AS TotalEmployees FROM position, employee WHERE position.position_id = employee.position_id GROUP BY title;

SELECT title, COUNT(ssn) AS TotalEmployees FROM position, employee WHERE position.position_id = employee.position_id GROUP BY title;

SELECT title, SUM(ssn) AS TotalEmployees FROM position, employee WHERE position.location_id = employee.position_id GROUP BY title;

Homework Answers

Answer #1

The answer is:

SELECT title, COUNT(ssn) AS TotalEmployees FROM position, employee WHERE position.position_id = employee.position_id GROUP BY title;

Explanation:

  • The select statement is selecting the title and the count of employees which is required as the output of the query
  • The tables are position and employees
  • we need to extract those employees using the WHERE statement where the position ids are the same. This is the link between the two tables
  • Grouping again is by title

Additional notes - The reasons other options were eliminated:

  • We need to take the count of SSN and not the sum of SSN
  • Here location is not important as we need to display all of the position titles and the number of employees that hold that position.

Let me know in the comments if anything is not clear. I will reply ASAP! Please do upvote if satisfied!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Consider the Goldstar database. Choose the query that displays the average salary for all positions in...
Consider the Goldstar database. Choose the query that displays the average salary for all positions in the city of Chicago. SELECT title, AVG(max_salary) AS AverageSalary FROM position, employee, location WHERE location.location_id = employee.location_id AND position.position_id = employee.position_id AND city = "Chicago" GROUP BY title; SELECT title, AVG(salary) AS AverageSalary FROM position, employee, location WHERE position.position_id = employee.position_id AND location.location_id = employee.location_id AND city = "Chicago" GROUP BY title; SELECT title, AVG(salary) AS AverageSalary FROM position, employee, location WHERE location.location_id =...
Consider the Goldstar database and the query below. What will the query display? SELECT city, COUNT(performance)...
Consider the Goldstar database and the query below. What will the query display? SELECT city, COUNT(performance) AS TotalEmployees FROM location, employee WHERE location.location_id = employee.location_id GROUP BY city; ? The total number of employees in each city that have NOT received performance ratings The total number of employees in each city The total number of employees in each city that have received performance ratings None of the other answers provided is correct
Which query lists all products with a total quantity sold less than the average quantity sold?...
Which query lists all products with a total quantity sold less than the average quantity sold? Select one: a. SELECT P_CODE, SUM(LINE_UNITS) AS TOTALUNITS FROM LINE GROUP BY P_CODE HAVING SUM(LINE_UNITS) < AVG(LINE_UNITS); b. SELECT P_CODE, AVG(LINE_UNITS) AS TOTALUNITS FROM LINE GROUP BY P_CODE HAVING AVG(LINE_UNITS) < (SELECT AVG(LINE_UNITS) FROM LINE); c. SELECT P_CODE, SUM(LINE_UNITS) AS TOTALUNITS FROM LINE GROUP BY P_CODE HAVING SUM(LINE_UNITS) < (SELECT AVG(LINE_UNITS) FROM LINE); d. SELECT P_CODE, SUM(LINE_UNITS) AS TOTALUNITS FROM LINE GROUP BY P_CODE...
4-16 In MySql, using Application MYSQL Workbench and the Chinook database, please write a query to...
4-16 In MySql, using Application MYSQL Workbench and the Chinook database, please write a query to answer this? -- 16. Display the ablumid, the title, and the length of each title for each row in the album table. Number 16 - use LENGTH function I just need to add the Lenghth function to this answer: SELECT ArtistId, SUBSTRING(ArtistName, 1, 5) AS ArtistName FROM Artist;
Oracle Assingment Introduction to databases Topics :Restricting and sorting data Create a query to display the...
Oracle Assingment Introduction to databases Topics :Restricting and sorting data Create a query to display the last name and salary of employees earning more than 1200 Display the last name and salary for all employees whose salary is not in the range of 5,000 and 10,000 Display the employee last name, job ID, and start date of employees hired between February 20, 1998, and May 1, 1998. Order the query in ascending order by start date. Display the last name...
Consider Sakila Database. Write a query in mySQL workbench to answer each of following questions. Q1)...
Consider Sakila Database. Write a query in mySQL workbench to answer each of following questions. Q1) By looking at city table. Write a query that identify the in how many cities the company has branches. Rename the column name to TotalNumberOfCities. You have to look at city table and write a query to count number of rows. Q2) By looking at film table. How many films we have that its description contains the word "Robot". Count number of films and...
How many customers placed orders between 1-Apr-03 and 31-May-03? COUNT 12 a.    SELECT COUNT(DISTINCT order_no)...
How many customers placed orders between 1-Apr-03 and 31-May-03? COUNT 12 a.    SELECT COUNT(DISTINCT order_no) AS count       FROM Orders       WHERE order_date BETWEEN '1-APR-03' AND '31-May-03'; b.    SELECT COUNT(DISTINCT order_no) AS count       FROM Orders       WHERE order_date BETWEEN '4/1/03' AND '5/31/03'; c.    a and b are correct d.    a and b are incorrect Question 2 (2 points) . Find product no. , brand and unit price of the products whose unit price is greater than the unit...
I am using Oracle HR. Write a query to display the last name of employees, length...
I am using Oracle HR. Write a query to display the last name of employees, length of the name, and first monday since the hire date. Make the query that the user is prompted to enter a letter that the last name start with by using a substitution variable for the letter. For example, if the user enters "H" or "h" when prompted, the output should show all employees whose start with letter H and make sure that the case...
1) In which clause of a query can a subquery not be used? (Choose two.) 2)...
1) In which clause of a query can a subquery not be used? (Choose two.) 2) The ORDER BY clause is allowed in an inline view true or false 3) the order by clause is not allowed in subqueries true or false 4) The operators IN and EXISTS are somewhat equivalent true or false 5) this Oracle error message? ORA-01427: single- row subquery returns more than one row >= = IN <= 6) SELECT 'TRUE' FROM dual WHERE 6 =...
The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode)...
The relational schema for the Academics database is as follows: DEPARTMENT(deptnum, descrip, instname, deptname, state, postcode) ACADEMIC(acnum, deptnum*, famname, givename, initials, title) PAPER(panum, title) AUTHOR(panum*, acnum*) FIELD(fieldnum, id, title) INTEREST(fieldnum*, acnum*, descrip) Some notes on the Academics database: An academic department belongs to one institution (instname) and often has many academics. An academic only works for one department. Research papers (PAPER) are often authored by several academics, and of course an academic often writes several papers (AUTHOR). A research field...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT