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
22 views
האם אנחנו יכולים להניח שאיחוד מוריד כפילויות

ושימוש ב

ALL

יוסיף את הכפילויות ?
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
אז ההוספה של
NOT EXIST
בתשובות של שאלה

בעצם מיותר??

http://courses.cs.tau.ac.il/databases/oldtests/DB1415B-solution.pdf
לא,
שים לב שבשאילתה השניה יש תנאי
o.numInstruments > 0
ולכן הן לא שקולות.

כלומר יכול להיות שב-
oneManBand
יש לנו להקה-של-איש-אחד שיש לה 0 כלים
אבל בפועל יש עבורה מספר רשומות ב-
bandMusicians
+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)
...