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 755009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:04:47+00:00 2026-05-14T15:04:47+00:00

I’m having some difficulties with two queries. I can get some of the information

  • 0

I’m having some difficulties with two queries. I can get some of the information but my problem lies in the some special conditions I just can’t seem to get right in the SQL statement.

The first query is in natural language defined:

I’m going to find all the candidates who has acquired two qualifications but during the same time period, but from different institutes

My Relational schema looks like this:

BOLD = primary key

ITALICS = foreign key

candidate = (candidateid, name, birth, mail)

qualification = (qualificationid, instituteid, candidateid, datestarted, datefinished, degreename, major)

institute = (instituteid, institutename, city)

The SQL I’ve tried to run is not very pretty (at this point) and not working either but it is:

select (candidate.firstname, candidate.lastname) 
from candidate, qualification, institute 
where (select count(qualification.candidateid) from qualification where qualification.candidateid = 2) 
and between qualification.datestarted and qualification.datefinished
and qualification.instituteid <> qualification.instituteid

I gives me an error and I’m pretty, almost certain that it is in the COUNT clause but I can’t seem to crack it to how to count the numbers of candidateid’s and set a condition to two (2) and then I’m pretty sure as well that there is a problem in my checking on the time period. They have to be in the same time period.
And by the way, the datestarted and the datefinished is in the DATE format.

My second query I’m having problems with is in natural language formulated like this:

Find the names of the companies who have all made inquiries about the candidates but with an average age below 30 (for the candidates).

My relation schemas look like this:

candidate = (candidateid, name, birth, mail)

qualification = (qualificationid, instituteid, candidateid, datestarted, datefinished, degreename, major)

inquiry = (inquiryid,candidateid, companyid)

The query I’ve tried is this:

select (company.companyname) as company
from company, inquiry, candidates
where company.companyid = inquiry.companyid
and inquiry.candidateid = candidate.candidateid
and (select avg(candidate.birth < (right(curdate(),5<right(birth,5)) from candidate)))

The BIRTH tuble is also described as a DATE field.

I hope you can help me out whit these two queries and if there is any question about ’em, please say so and I’ll try to clarify.

Mestika

  • 1 1 Answer
  • 2 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-05-14T15:04:47+00:00Added an answer on May 14, 2026 at 3:04 pm
    SELECT  *
    FROM    candidate c
    WHERE   EXISTS
            (
            SELECT  NULL
            FROM    qualification q1
            JOIN    qualification q2
            ON      q2.candidateid = q1.candidateid
                    AND q2.datestarted = q1.datestarted
                    AND q2.dateended = q1.dateended
                    AND q2.instituteid <> q1.instituteid
            WHERE   q2.candidateid = c.candidateid
            )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some difficulties with the following problem: I'm making a little game where
I'm having some difficulties to sort my results by Date. Is there any special
I'm having some difficulties with the PathCombine function. It does not seem to work
I am having some difficulties for feeling the space between two curves in a
I'm working on a homework problem and I'm having some difficulties creating a O(n*logn)
I just started using Mercurial, and I'm having some difficulties. I'm using Murky for
I just hosted my website and am having some difficulties. i used the codeigniter
I am converting my PHP/mySQL code to PDO but I am having some difficulties.
I'm having some difficulties creating a javascript appointment style calendar. While it does render,
I'm having some difficulties getting the TabActivity to work. Here's the implementation of 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.