Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8764839
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:07:52+00:00 2026-06-13T16:07:52+00:00

I have a university practical next week on databases. I need to create 15

  • 0

I have a university practical next week on databases. I need to create 15 queries around a scheme on a university, which looks as follows:

  • Student(Student_No, First_Name , Last_Name, Sex, Date-Of-Birth, Address, Level, Degree_Code)
  • Degree(Degree_Code, Degree_Name, School_Name)
  • Module(Module_Code, Module_Title, School_Name)
  • School(School_Name, Faculty, Head-of-School)
  • Take_Exam(Student_No, Module_Code, Mark)

I have completed 14 of the queries but I am stuck on this one:

  • Retrieve the names of students who take every Module. (Hint. use not exists).

I have been reading up on not exists queries, but I just don’t even know where to start!
I created this piece of code:

select students.student_no, fname, lname, count(module_code)
from students left join take_exam using (student_no)
group by student_no
having count(module_code) < 19
order by lname;

This returns all students who DON’T take all 19 modules. However, I hate the code as it involves having < 19, which meant if the amount of modules ever changed later, this value would need changes which is inefficient.

Can anyone point me in the right direction and give me some guidance on using ‘not exists’ queries?

Thanks, Andrew

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:07:53+00:00Added an answer on June 13, 2026 at 4:07 pm

    Using not exists :

    select *
    from Student s1 
    where not exists 
             (select 1 
              from Module 
              where Module_Code not in
                          (select Module_Code 
                           from Take_Exam 
                           where Student_No = s1.Student_No)
    

    Explanation :

    For each student s in the table Student, we’ll add s to the result, iff :
    not exists any module in table Module such that this module is not mapped to student s in table Take_Exam.

    It’s not intuitive, but it’s exactly the same as :
    “all the students who take every module”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this University assignment in which I have to create a trigger
I have a file universities.txt which looks like this: Alabama Air University Alabama A&M
I have a university project which is already 99% completed. It consists of two
This is the code for an upcoming university practical I have: import java.util.Random; public
I am a university student. I have been working a lot with Android lately
For my university I have to create an application that for the User Interfaces
I have a file called Student.h which have the static integers in this way:
I need to implement a B-Tree for University: I have an outer class B-Tree
I have a list of university urls like www.harvard.edu, www.berkeley.edu etc. I need to
I have two Entities University courses Course students i want to access all the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.