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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:07:03+00:00 2026-05-23T09:07:03+00:00

I was looking up different ways to write a query, and I’m just wondering

  • 0

I was looking up different ways to write a query, and I’m just wondering which way do you all think is better way to go with the following options:

SELECT a.salary 
  FROM emp a
  JOIN emp b ON a.salary < b.salary
 WHERE b.id = 200

or

SELECT salary 
  FROM emp
 WHERE salary < (SELECT salary 
                   FROM emp 
                  WHERE id = 200)

I did some execution times with about 300 records in the table, and they come out about the same, so this is really just more about preference and accepted standards. I personally like the 2nd way better (just easier to read to me). I have a feeling the 1st is standard though. What do you all think?

  • 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-05-23T09:07:04+00:00Added an answer on May 23, 2026 at 9:07 am

    I don’t think there is a definite answer to this question as it’s really dependent on the context of the query itself & the RDMS.

    So in your case, you’ve done the research with 300 records. How about 3,000,000? Does it make a difference?

    Personally I like Joins over Sub-Queries if I can help it, but like I said, this is really determined on a case by case basis.

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

Sidebar

Related Questions

i am looking for opinions if the following problem maybe has a better/different/common solution:
I'm looking for a way to poll different servers and check that SQL server
I've been looking into different web statistics programs for my site, and one promising
I am currently looking at different ORM solutions for a project that is planned
I'm looking into building a content site with possibly thousands of different entries, accessible
I'm looking for best practices for using the same data in different places without
I am looking for a regex pattern that would match several different combinations of
I'm looking for the least impacting method to read a few different log files.
For example, I'm looking at the jCalendar source, and the creator has two different
I was looking at Stack Overflow question What is the difference between abstract function

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.