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
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...
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...
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...
1. We sell music  to our members. Employees recommend titles by rating them from1 to 5 with...
1. We sell music  to our members. Employees recommend titles by rating them from1 to 5 with 1 being not very good to 5 being very good What would your strategy be to write SQL code for the following query: "Show the members and the title and price for each of the products they bought." I would use a left outer join I would not use a join because the data comes from one table I would use an equality join...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID...
Could you script in Matlab : Script Name General Algorithm AddNewEmployee Display all of the ID numbers currently in use Read in a new ID number If the ID number read in is already in use Report this fact End this script Else (this is a new ID number) Read in: Years with the company Salary Vacation days Sick days Add this new employee to the database (by appending a new row to the end of the EmployeeData matrix) Note...
Problem 8.2 c from Databases Illuminated Third Edition:Assume you have a statistical database with the following...
Problem 8.2 c from Databases Illuminated Third Edition:Assume you have a statistical database with the following schema. The only legal queries are those involving COUNT, SUM, and AVERAGE. newFaculty(facId, lastName, firstName, department, salary, rank, dateHired) a. Write a legal SQL query to find the salary of the only faculty member who is an instructor in the Art department. b. Assume the system will refuse to answer queries for which only one record satisfies the predicate as in (a). Write a...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL...
EMPLOYEE Field Name EMP_ID EMP_LNAME EMP_MI EMP_FNAME EMP_SEX EMP_AGE EMP_SALARY EMP_HIREDATE DEPT_CODE Table: DEPARTMENT DEPT_CODE BIOL CPTR HIST MATH RELB Data Type Text Text Text Text Text Number Currency Date/Time Text DEPT_TITLE Biology Computer Science History Mathematics Religion    Field Name DEPT_CODE DEPT_TITLE Data Type Text Text INSTRUCTIONS Use SQL commands to create the tables and enter the data shown above using MS Access. Write the following SQL statement given below: 1. 2. 3. 4. 5. 6. 7. 8. 9....