Concept explainers
help with sql class
Report the names of the professors who work on the most number of projects
The SQL code is as following
-- select columns p.prof_name, s.student_name with distinct keyword to get unique values
select distinct p.prof_name, s.student_name
from Supervise as sp -- from Supervise table with an alias name sp
inner join Professors as p -- inner join Professors to Supervise with an alias name p
on sp.prof_id = p.prof_id -- on condition to join both the tables
inner join Students as s -- inner join Students to Professors with an alias name s
on sp.student_id = s.student_id -- on condition to join both the tables
union -- union operator to combine left and right queries
select p.prof_name, concat('Total ', COUNT(distinct sp.student_id)) -- select columns p.prof_name, concat('Total ', COUNT(distinct sp.student_id))
from Supervise as sp -- from Supervise table with an alias name sp
inner join Professors as p -- inner join Professors to Supervise with an alias name p
on sp.prof_id = p.prof_id -- on condition to join both the tables
group by p.prof_id, p.prof_name -- group by to aggregate per professor
order by prof_name; -- order by to sort the results by professor name
Step by stepSolved in 2 steps with 1 images
- Using SQL determine salary is above 4000 and job_id starts with a letter “S” In addition, when grouping the above selected employees by department, we only show the department which has more than 5 employees or the minimal salary greater than 5000, and order the result by the average salary.arrow_forwarddefine view named itemorder. using sql write the view definition of itemordearrow_forwardSQL Write a query that displays the VendorID, Vendor Name and Total Invoice for each Vendor in California. Please note that you must use multiple tablesarrow_forward
- IN SQL If you omitted the WHERE clause of SELECT statement, the query returns an error because the where clause is required. Select one: True Falsearrow_forwardUsing SQL: List the title_name and book type of books that have the lowest royalty rate.arrow_forwardDatabase sql 1-Write the syntax to create an object table called people using people_typearrow_forward
- List the item ID, description, and category for each pair of items that are in the same category. (For example, one such pair would be item FS42 and item PF19, because the category for both items is FSH.) Order the output by category. From MT SQL 10th Editionarrow_forwardDescribe the use of the CAST and CONVERT functions in SQL.arrow_forwardhow do you use PL/SQL or T-SQL procedures in SQL?arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education