Question
Please read the very important thing. I've been saying this code is wrong since last time, but I don't understand if you guys keep giving
Please read the very important thing. I've been saying this code is wrong since last time, but I don't understand if you guys keep giving it to me. Please give me another code, not this one, until I write the both wrong code at the bottom of the question. And please give me the perfect answer to the question. And please use the name next to the create table.
basic information 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.
Question
1. 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.
both wrong code
with course_enrollment as (
select course_id, count(stundent_id) as number_students - it is student_id it is not working so it is wrong code
from(
select distinct course_id, student_id
from takes
where year = '2006'
)as unique_takes
group by course_id
)
select title, number_students
from courses_enrollment ce
join course c on ce.course_id = c.course_id
order by number_students
other wrong code
with course_enrollment as { select course_id, count(ID) as number_students
from(
select distinct course_id, ID
from takes
where year = 2006
)as unique_takes
group by course_id
)
select title, number_students
from courses_enrollment ce
join course c on ce.course_id = c.course_id
order by number_students
DDL information
nofnam kau (T) Masianas Connends concleted soodesstu11\%. W ** Uriversity-DDLLsgl - DESKTOP-GBT/1G9. university1 (DESKIOP-GBI71G9YLe (56)] - Miciosoft SQL Server Management Studio Quick Laundh (CtrlQ) P File Edit View Query Project Tools Window Help Masiagas Connends concleted sootesstuli?. Masianges Connands cornleted socdesstu11?. Duery executed successfully. ** Uriversity-DDLLsgl - DESKTOP-GBT/1G9. university1 (DESKIOP-GBI71G9YLe (56)] - Miciosoft SQL Server Management Studio Quick Laundh (CtrlQ) P 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