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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T19:35:14+00:00 2026-05-14T19:35:14+00:00

In SQL, there is an operator to Union two tables. In an interview, I

  • 0

In SQL, there is an operator to “Union” two tables. In an interview, I was told that, say one table has just 1 field with 1, 2, 7, 8 in it, and another table also has just 1 field with 2, and 7 in it, how do I get the intersection. I was stunned at first, because I never saw it that way.

Later on, I found that it is actually a “Join” (inner join), which is just

select * from t1, t2 where t1.number = t2.number

(although the name “join” feels more like “union” rather than “intersect”)

another solution seems to be

select * from t1 INTERSECT select * from t2

but it is not supported in MySQL. Are there different ways to get the intersection besides these two methods?

  • 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-14T19:35:15+00:00Added an answer on May 14, 2026 at 7:35 pm

    This page explains how to implement INTERSECT and MINUS in MySQL. To implement INTERSECT you should use an inner join:

    SELECT t1.number
    FROM t1
    INNER JOIN t2
    ON t1.number = t2.number
    

    Your code does this too, but it is not recommended to write joins like that any more.

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

Sidebar

Related Questions

in an sql table there's an id, first name and last name field. i'd
Is there a SQL command that will list all the tables in a database
Is there a SQL statement that will list the names of all the tables,
I have a SQL database that has several hundred tables in it, but I
System is: SQL Server 2008-R2 I have a table that one of its column
I have joined two SQL Queries using SQL UNION Operator Example: $query1 = SELECT
Is there a way to reverse the SQL Like operator so it searches a
In SQL Server there is a way to join tables from multiple sql servers
The problem is that it takes way to long in SQL and there must
There is in operator in SQL SELECT * FROM MyTable WHERE id IN (1,

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.