Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name: For the next set of questions, select one of the two data models you creat

ID: 3830424 • Letter: N

Question

Name: For the next set of questions, select one of the two data models you created in answering questions 1 and 2 and use it to answer the following. 3. (15 points) Create the database designed in your answer above. Create the table in the database you use and copy and paste the table creation script here. 4. (10 points) Populate the database created in answer to question 3. Populate the table in the database you use and copy and paste the table insertion script here. Your data should match that provided in the corresponding chart above. 5. (25 points) write five saL queries from the above data demonstrating the following skills. I just need to see the SQL scripts, not the results. a. Use of the Group by Statement b. Use of multiple tables in one statement c. Use of the between statement d. Use of the having statement e. Use of a subquery (IN or EXISTS)

Explanation / Answer

5. a) Suppose you have a table named employee_grp1 then if you want to print its minimum salary of each deparment id then query woulld be something like below.

5.b) Suppose you have two tables in the database named employees_grp1 as first table and employees_grp2 as 2nd table. And if you want to update the salary of employees which are common to both tables then query would go like below.

5.c) Suppose you want to print the details of all employee from table employee_grp1 whose salary lies between 20000 to 30000, then query would be like below.

SELECT * FROM employee_grp1

WHERE salary BETWEEN 20000 AND 30000;

5. d) Suppose we want to print the employee id count from states greater then 10 then query will be written as

SELECT COUNT( id ), State
FROM employees_grp1
GROUP BY State
HAVING COUNT(id) > 10;

5. e) Suppose we want to print the employees from table employee_grp1 and employee_grp2 as subquery based on emplyee id then query would be like.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote