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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:49:04+00:00 2026-06-01T05:49:04+00:00

Please explain the SQL query given below. I m new with SQL and struggling

  • 0

Please explain the SQL query given below. I m new with SQL and struggling with Join Statements.
Thanks in advance.

select a.ename    as attendee
,      t.ename    as trainer
from   employees     t
       join
       offerings     o on  (o.trainer = t.empno)
       join
       registrations r using (course, begindate)
       join
       employees     a on (r.attendee = a.empno)
 where  course = 'SQL';
  • 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-01T05:49:06+00:00Added an answer on June 1, 2026 at 5:49 am

    This query gets the names of all attendees and their trainer’s name for all ‘SQL’ courses.
    You have a database with at least 3 tables: employees, offerings and registrations.
    An Employee can register for a course offering and the trainer of a course offering is also an Employee. To register for an Offering, you must provide the course name and the begin date of that course.

    employees t join offerings o on (o.trainer = t.empno)
    

    Here employees are related to course offerings using the trainer nr and the employee number. To make it clear that here we are only interested in those Employees who are trainer, the alias name “t” was used for the Employee table. “o” is the alias name for the Offerings table. This join gives us all courses for which the trainer is known and is an employee.

    join registrations r using (course, begindate)
    

    Here registrations are related to the course offerings using the course name and the begindate of the course offering. The previous line is equal to:

    join registrations r on o.course = r.course AND o.begindate = r.begindate
    
    
    join employees a on (r.attendee = a.empno)
    

    Here employees are related to registrations using the attendee nr and the employee number. To make it clear that here we are only interested in those Employees who are attendee of a course, the alias name “a” was used for the Employee table.

    where  course = 'SQL';
    

    Up till now we have a long list of all trainer-employees with ethe courses they trained, the registrations and their attendee-empleyees. Of that long list we are only interested in those rows where the course name equals “SQL”.

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

Sidebar

Related Questions

Given the SQL statements below, I would expect the result of the query to
Can anyone please explain the below SQL statement from Oracle DB: select decode(TRIM(to_char(SYSDATE,'Day')),'Monday','3','1') from
Please explain what is meant by tuples in sql?Thanks..
Can someone please explain me this SQL query. This shows me the popular stores,
Cannot dump Stack Overflow XML file into SQL Server 2008. Could you please explain
Please explain why dictionary's 'getAt' method fails List<BString> infoKeys = new List<BString>(infoDict.Keys); if (infoKeys.Contains(TorrentFileKeyWords.FILES_KEY)
Him Please explain what is the difference between different datasources for SQL (shown in
Can someone please explain to me what the # symbol means in MS SQL
Can someone please explain what is the main difference between SQL Server Compact Edition
Please see below SQL Server 2005 script Declare @xmlData XML SET @xmlData = '<?xml

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.