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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:21:20+00:00 2026-06-12T13:21:20+00:00

I have two SQL tables Student and Class . In Student table, the fields

  • 0

I have two SQL tables Student and Class.

In Student table, the fields are studentNo, studentName, classNo

In Class table, fields are classNo, className, teacherName

what I am trying to do is construct a query to list all students who are in the history class.

Here is my query:

SELECT studentName
FROM Student s, Class c
WHERE s.classNo = c.classNo AND
   c.className = ‘history’;

But I am not 100% sure about the above query. and I am thinking maybe the following one can work than the above one:

SELECT studentName
FROM Student s, Class c
WHERE c.className = ‘history’ AND
   s.classNo = c.classNo;

Can anyone help me find the correct query to this problem? thank you

  • 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-12T13:21:21+00:00Added an answer on June 12, 2026 at 1:21 pm

    Your current query seems fine but mind if you convert it into ANSI SQL_92 format (more clear, and may not lead to cross join),

    SELECT studentName
    FROM Student s INNER JOIN Class c
           ON s.classNo = c.classNo
    WHERE  c.className = 'history';
    

    There is no difference if you interchange the two. In math, commutative law states that A + B = B + A.

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

Sidebar

Related Questions

In SQL Server 2008 I have two tables. One table for users: id_user -
I have two sql tables Players and Teams joined by a PlayerTeam junction table.
I have the following two sql tables: The GlassesID Column in Glasses table is
I'm trying to join two SQL tables, parent (which I have complete design control
I have two tables. 1- student table & 2- Score table I want to
I have two sql tables called scan_sc and rescan_rsc . The scan table looks
I have two SQL Server tables. One table has four nvarchar(50) nullable columns and
I have two sql tables for user login, store and retrieve data according to
I have two SQL Server tables with Primary Keys (PK) and a Foreign Key
I have two identical SQL Server tables ( SOURCE and DESTINATION ) with lots

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.