Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

Students also viewed these Databases questions

Question

Describe the types of power that effective leaders employ

Answered: 1 week ago

Question

Describe how leadership styles should be adapted to the situation

Answered: 1 week ago