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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:34:19+00:00 2026-05-28T01:34:19+00:00

Say, I have the below two tables —————————— | employee | —————————— | employee_id

  • 0

Say, I have the below two tables

 ------------------------------
|           employee           |
 ------------------------------
| employee_id  | employee_name |  
 ------------------------------
|     1        |     one       |
|     2        |     two       |
|     3        |     three     |
 ------------------------------

and

 -------------------------------------------
|                feedback                   |
 -------------------------------------------
| employee_id (FK)  |       comments        |  
 -------------------------------------------
|         2         |     comment two       |
 -------------------------------------------

What is the best (in terms of performance) way of retrieving all employees who have not had their feedback given?

I was thinking of the below SQL but because it uses subquery, I am not sure how fast it will be when the number of records in both the tables grow.

SELECT * FROM employee WHERE employee_id NOT IN (SELECT employee_id FROM feedback)

The database is Oracle and all key columns have indexes.

Update

Thanks everybody, I wish I could accept more than one answer! This is what I used in the end (my table structure wasn’t quite as simple as shown here as I had joins with several other tables).

SELECT 
    e.name, m.name, a.postcode 
FROM 
    employee LEFT OUTER JOIN feedback f on (e.employee_id = f.employee_id),
    address a, manager m 
WHERE a.address_id = e.address_id
AND m.manager_id = e.manager_id
AND f.employee_id IS NULL
  • 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-28T01:34:19+00:00Added an answer on May 28, 2026 at 1:34 am

    You could use:

    SELECT e.* 
      FROM employee e 
      LEFT OUTER JOIN feedback f ON (e.employee_id = f.employee_id)
     WHERE f.employee_id IS NULL 
    

    Which should be pretty good. I assume the EMPLOYEE_ID columns are indexed…

    Try it and see what your explain plan looks like.

    EDIT: As you have said you do not have the PLAN table then this article from Tom Kyte (Oracle VP) is useful:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:313616750808

    It suggests reasoning behind why each solution (NOT IN, NOT EXISTS, OUTER JOIN) might be better under circumstances.

    There is also this from the prolific Don Burleson:
    http://www.dba-oracle.com/oracle_tips_subq_rewrite.htm

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

Sidebar

Related Questions

Say I have two tables, user and comment . They have table definitions that
I currently have a database with two tables in it one hold lets say
Say I have two tables as outlined below: mysql> show columns from ping; +------------+------------------+------+-----+---------+----------------+
Well interesting to me at least... Say I have two tables: myLookUpTable: lookupId |
Here i need help with joins. I have two tables say articles and users.
Say, I have two tables Person and Car and I link these two. The
I have two tables say ( FCT_SALES_SUMMARY_A and FCT_SALES_SUMMARY_B ). If we assume that
I have two simple tables let's say country and state . Suppose, I need
From the regular aspnet_Users table I have created two sub-tables with one to one
This is the situation: I have two tables where the one references the other

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.