question

Newbie10 avatar image
Newbie10 asked

SQL Help Query

Q. Given the following database table: First Name Last Name Department Name Salary Janet. Marshall. IT. 35000 Adam. Marks. Sales. 27500 Alice. Matters. IT. 32500 George. Flinders. HR. 27000 Thomas. Born. Sales. 42500 Marcus. Channing. IT. 37500 Write a SQL query that will list each department name along with the total salary for that department and the number of employees in that department. Can you suggest any way(s) to improve this table structure by normalising the data? Re-write the same SQL query to work against your improved table structure. Give 2 advantages of your improved table structure over the original.
querysql query
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sjimmo avatar image sjimmo commented ·
This sounds very much like a homework assignment. What have you tried, and what were your results? What are your suggestions for normalization?
0 Likes 0 ·

1 Answer

·
Newbie10 avatar image
Newbie10 answered
For the query I would say SELECT DEPARTMENT but I don't know how to total the salary and the number of employees.,I would say for the query SELECT DEPARTMENT but I don't know how to add the salary amounts up and to count the number of employees.
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.