Welcome to TDBSoverflow, Our class's own StackOverflow. Our rules:
  1. Use only meaningful and self-explanatory titles
  2. Tag your questions with meaningful keywords
  3. Use upvotes and downvotes to rate the answers
  4. When you receive a satisfying answer - Click the "V" button
Remember: you may get up to 5 bonus points to your final grade!

using UNION in SQL

+1 vote
האם אנחנו יכולים להניח שאיחוד מוריד כפילויות

ושימוש ב


יוסיף את הכפילויות ?
asked Feb 3, 2018 by tikitak (2,970 points)

2 Answers

+1 vote
Best answer

By definition, the UNION operator removes duplicates; if you want to reserve duplicates, use UNION ALL:

The UNION operator selects only distinct values by default. To allow duplicate values, use UNION ALL.

More information here.

answered Feb 3, 2018 by oz (12,430 points)
selected Feb 4, 2018 by tikitak
אז ההוספה של
בתשובות של שאלה

בעצם מיותר??

שים לב שבשאילתה השניה יש תנאי
o.numInstruments > 0
ולכן הן לא שקולות.

כלומר יכול להיות שב-
יש לנו להקה-של-איש-אחד שיש לה 0 כלים
אבל בפועל יש עבורה מספר רשומות ב-
+1 vote

Yes, that's exactly the difference between UNION and UNION ALL.

(See https://stackoverflow.com/questions/49925/what-is-the-difference-between-union-and-union-all;

Tova also said it in class)

answered Feb 3, 2018 by Assaf (31,090 points)