Question
I need the perfect answers to the questions. For questions 1-5, you can only use a single SQL statement unless otherwise specified (you can use
I need the perfect answers to the questions.
For questions 1-5, you can only use a single SQL statement unless otherwise specified (you can use UNION/INTERSECT/EXCEPT and the WITH clause if needed). Provide your answers and screenshots of the results in the required areas. Your SQL statements should have the correct logic and display the correct results as well.
1. For each building, find the number of different instructors who have taught at least one course section in that building since the year 2008 (including 2008). Do not display the building if no instructors have taught there since 2008. The result should display the building name and the number of instructors (give a proper column name). Note: there is more than one table which has a building column, and you need to figure out which one to use.
Copy and paste your SQL statement below
Insert the screenshot of result below
2. Find the ID and name of the instructors who taught at least one course in their own departments but did not teach any courses in other departments. Remove duplicates in the result.
Copy and paste your SQL statement below
Insert the screenshot of result below
3. Find the instructors who earn the second lowest salary in their own departments. Display the name, department name, and salary of these instructors in the alphabetical order of instructor name.
Copy and paste your SQL statement below
Insert the screenshot of result below
4. Find the course(s) taken by the fewest students in the year 2006. The result should display the course title and the number of students. If a student has taken the same course more than once, this student should be counted only once.
Copy and paste your SQL statement below
Insert the screenshot of result below
5. Find the department(s) with the fourth lowest number of students. Display the department name and the number of students in the department (give a proper column name) in the result.
Copy and paste your SQL statement below
Insert the screenshot of result below
6. Update the salaries of the instructors as follows.
a) Increase salary by 6% for the instructors who taught at least 3 different courses (different course_id);
b) Increase salary by 4% for the instructors who taught exactly 2 different courses;
c) Increase salary by 2% for other instructors (including the instructors who did not teach).
Please use BEGIN TRAN and ROLLBACK properly (CREATE VIEW is not allowed to use; you may use the WITH clause within BEGIN TRAN and ROLLBACK). You must use the CASE expression.
Copy and paste your SQL statement below
Insert the screenshot of execution, which shows the number of rows affected and completion time.
create tavie instructor (1D varchar(s), nate varchar(29) not null, dept_namc varchar(29), salary nuteric (8,2) check (salary > 29006). peinary kay (T), foreigri key (dept_nane) references department on delete set null 1: X* Uriversity-DDL.sGl-DESKIOP-GBT/1G9.rraster (DESKIOP-GBI/1G9Le (56)) - Microsoft SQL Server Maragement Studio Quick Launch (Ctrl I Q) = File Edit View Query Project Tools Window Help X* Uriversity-DDL.sGl-DESKIOP-GBT/1G9.rraster (DESKIOP-GBI/1G9Le (56)) - Microsoft SQL Server Maragement Studio Quick Launch (Ctrl I Q) = File Edit View Query Project Tools Window Help X* Uriversity-DDL.sGl-DESKIOP-GBT/1G9.rraster (DESKIOP-GBI/1G9Le (56)) - Microsoft SQL Server Maragement Studio Quick Launch (Ctrl I Q) = File Edit View Query Project Tools Window Help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started