Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

we have these tables: please write the SQL code for the following questions begin{tabular}{|l|l|l|l|l|l|l|} hline multicolumn{6}{|c|}{ employee } & hline employeeid & ( begin{array}{l}text

we have these tables:

image text in transcribed

please write the SQL code for the following questions image text in transcribed

\begin{tabular}{|l|l|l|l|l|l|l|} \hline \multicolumn{6}{|c|}{ employee } & \\ \hline employeeid & \( \begin{array}{l}\text { employee_ } \\ \text { fname }\end{array} \) & \( \begin{array}{l}\text { employee_1 } \\ \text { name }\end{array} \) & address & dep_no & salary & hire_date \\ \hline 2200 & Huda & Ahmad & Albasateen & 102 & 5000 & 22102019 \\ \hline 2202 & Mona & Saeed & Almarwah & 101 & 4000 & 15072020 \\ \hline 2204 & Fatimah & Saleh & Alsafa & 102 & & 02022021 \\ \hline 2206 & Lobna & Muhammad & Alshati & 103 & 5300 & 15062015 \\ \hline 2208 & Maha & & Almarwah & 103 & 4500 & 01012017 \\ \hline 2210 & Suha & Rami & Alolaya & 101 & & 20112020 \\ \hline 2212 & Samirah & Samir & Alworood & 104 & 6000 & 02102021 \\ \hline 2214 & Sara & & Albasateen & 103 & 2500 & 17012020 \\ \hline \end{tabular} \begin{tabular}{|l|l|l|} \hline \multicolumn{3}{|c|}{ department } \\ \hline department_ id & department name & manager id \\ \hline 101 & Accounting & 2202 \\ \hline 102 & Administration & 2208 \\ \hline 103 & Information Technology & 2210 \\ \hline 104 & Sale & 2214 \\ \hline \end{tabular} \begin{tabular}{|l|l|l|} \hline \multicolumn{3}{|c|}{ dep manager } \\ \hline manager_id & department_id & office location \\ \hline 2200 & 102 & First Floor \\ \hline 2202 & 101 & Ground Floor \\ \hline 2206 & 103 & First Floor \\ \hline 2212 & 104 & Second Floor \\ \hline \end{tabular} Use group functions for question 5 : 5. Display the average, max and minimum salary for the employee in each department. Use join statement to do the questions 6 - 7: 6. Display employees full name and department name for employees that do not have salary yet. 7. Display department id, department name, and office location for managers in the first floor. 8. Delete all sales department (Make sure all related records in other tables are deleted as well. Hint: Cascade)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions