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

  • Home
  • SEARCH
  • 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 8001857
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:12:12+00:00 2026-06-04T16:12:12+00:00

I have several tables: lecturer(id,name,email) – 1,john,john@abc.com – 2,andy,andy@abc.com – 3,kyle,kyle@abc.com – 4,allen,allen@abc.com sig(id,name)

  • 0

I have several tables:

lecturer(id,name,email)
- 1,john,john@abc.com
- 2,andy,andy@abc.com
- 3,kyle,kyle@abc.com
- 4,allen,allen@abc.com

sig(id,name)
- s1, Multimedia
- s2, Business IT

expertise(id, description); 
- e1, Gaming
- e2, Graphic
- e3, Multimedia System
- e4, E-Business

lecturer_has_expertise(lecturer.id,expertise.id)
- 1, e1
- 2, e2
- 3, e4
- 4, e1

lecturer_has_sig (lecturer.id,sig.id)
- 1, s1
- 2, s1
- 3, s2

sig_has_expertise(sig.id,expertise.id)
- s1, e1
- s1, e2
- s1, e3
- s2, e4

Here is the output I want to show:

Lecturer's Name, Email, Expertise

Basically, when a user inputs a keyword eg: Gaming into the textbox, it will show which lecturer’s expertise is gaming and since Gaming is under Multimedia,data about all lecturer in the sig of Multimedia also will be shown. For example:

Name   Email            Expertise
John   john@abc.com     Gaming
Allen  allen@abc.com    Gaming
Andy   andy@abc.com     Graphic    

I manage to output only the expertise that is input by the user but not all the expertise in the same sig.

thanks in advance

  • 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-04T16:12:14+00:00Added an answer on June 4, 2026 at 4:12 pm

    So basically you want to return every teacher who either

    • has the specified expertise

      or

    • belongs to a group that has the specified expertise.

    This is how the above translates in SQL:

    SELECT
      l.name,
      l.email,
      e.description AS expertise
    FROM lecturer_has_expertise le
      INNER JOIN lecturer l ON l.id = le.lecturer_id
      INNER JOIN expertise e ON e.id = le.expertise_id
    WHERE e.description = @InputExpertise
       OR EXISTS (
         SELECT *
         FROM lecturer_has_sig ls
           INNER JOIN sig_has_expertise se ON ls.sig_id = se.sig_id
           INNER JOIN expertise e ON e.id = se.expertise_id
         WHERE e.description = @InputExpertise
           AND ls.lecturer_id = le.lecturer_id
       )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several tables that have similar fields, for example, Name and Email address:
I have a page with several tables on it with the same class name.
I have several databases that have tables with the same name. I mean, I
I have several tables: CREATE TABLE [dbo].[Tracks]( [Id] [uniqueidentifier] NOT NULL, [Artist_Id] [uniqueidentifier] NOT
I have several tables that I want to put side by side, however when
I have several database tables that just contain a single column and very few
I have to compute a value involving data from several tables. I was wondering
I have a data-upload function that load some data into several tables and processes
I have an Access database (in Access 2003) with several tables, and data must
We have the following structure: ReportsDatabase X Report Y Report Y uses several tables

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.