Questions tagged [set-operations]

Set operations as a branch of set theory which includes operations such as: Union, Intersection, Subset, Set Difference, Symmetrical Set Difference, and Set Equality.

References

88 questions
2
votes
3 answers

how to intersect elements of one column along with group_by in R

Lets assume, my data is like group_id col1 1 1 A,B 2 1 B,C 3 2 A,C 4 2 B,D 5 3 A,D 6 3 A,B,C,D I would like to summarise/mutate col1 where its elements are intersected within same…
AnilGoyal
  • 25,297
  • 4
  • 27
  • 45
2
votes
1 answer

How do I avoid a "TypeError: unhashable type: 'dict'" when computing list differences?

I'm using Python 3.8. I have two lists, with each element being a dict ... >>> existing_dicts = [{"id": 1}, {"id": 2}] >>> cur_dicts = [{"id": 2}] I wanted to find the dicts that were no longer in "cur_dicts" that were originally in…
Dave
  • 15,639
  • 133
  • 442
  • 830
2
votes
2 answers

Is there a javascript function for finding the first set that contains one element each from a group of sets (if such a set exists for that group)?

I'm trying to find a solution to a problem like the following, where I have three sets (technically arrays, but they will always be guaranteed not to have repeating elements and they will always have their elements in increasing order), and I need…
SheffDoinWork
  • 743
  • 2
  • 8
  • 19
2
votes
2 answers

A generic set operations class i.e. intersection, union, minus etc

I want to write a C++ class that offers set operations that work on vectors of strings and vectors of my own data type. Are there any easy ways of doing this rather than writing a different function for each data type? So far I have written…
ale
  • 11,636
  • 27
  • 92
  • 149
2
votes
3 answers

Need to find Basic Operations Sets Union/Intersect/Symmetric Difference JAVA

Need to finish implementing this to use UseSet class. Not sure if what I have implemented is 100% correct. However I need help with the Union and SysDiff. public class Set { private ArrayList elements; public Set() { …
Harmi
  • 21
  • 1
  • 3
2
votes
1 answer

Set operations on list of sets in R using sets package

I am using sets package in R. Now, i have a list of sets and I want to perform set operations on the list without having to loop. Like, I can do set_intersection with a variable number of arguments set_intersection(set(1,2), set(2,3), set(4,5),…
Muhammad Adeel Zahid
  • 17,474
  • 14
  • 90
  • 155
2
votes
2 answers

SQL Set Operators - Selecting rows from tables with different columns

I'm using Oracle 10g, and I'm trying to select rows from one table that do not appear in the other table in the query using a set operator. I'm trying to select id, last_name and first_name columns from an employee table in which these rows do not…
ethane
  • 2,329
  • 3
  • 22
  • 33
2
votes
2 answers

How do I determine if a group of data exists in a table, given the data that should appear in the group's rows?

I am writing data to a table and allocating a "group-id" for each batch of data that is written. To illustrate, consider the following table. GroupId Value ------- ----- 1 a 1 b 1 c 2 a 2 b …
Steve Guidi
  • 19,700
  • 9
  • 74
  • 90
2
votes
6 answers

Extract the different recored in two table

I have two tables - table1 and table2. Both tables have the same columns. I want to extract the record differences - meaning extract records in table1 not in table2, and extract records in table2 not in table1. How I can do that by using SQL in…
Nawaf
  • 540
  • 1
  • 5
  • 14
1
vote
0 answers

Database optimised for set operations

I want to know the database or platform that will be most suitable for performing heavy set operations. Especially INTERSECTION, DIFFERENCE over millions of values in sets.
aRvi
  • 2,203
  • 1
  • 14
  • 30
1
vote
1 answer

Does AWS Athena support set operation?

Try to use set operation but seems not to work in Athena. Is it not supported or is there anything wrong with the SQL? SELECT DISTINCT cik FROM xbrl MINUS SELECT cik FROM xbrl WHERE year IN (2015,2014,2013,2012,2011,2010) line 3:1: mismatched…
mon
  • 18,789
  • 22
  • 112
  • 205
1
vote
1 answer

Why are the words from the text file displayed in the program in alphabetical order instead of the order of how the text files put it?

So, I have the work mostly done here, but I can't seem to figure out how to have the words in the order of how the text files displays it. It just takes the words from the text files, and puts the words in alphabetical order. Text Files are at the…
Game Face
  • 11
  • 3
1
vote
1 answer

Set operations in DBIx::Class

What is the best way to perform set operations using DBIx::Class? I saw that one solution would be to create a Result Source based on my query, but my conditions will be defined by the user and I don know if the best answer is to create the result…
nsbm
  • 5,842
  • 6
  • 30
  • 45
1
vote
2 answers

Is there anything to perform union of two lists in Erlang?

I found out that there are set operations for sets in Erlang, but I could not find out similar operations for lists. I want to perform the basic union operation in lists in Erlang: A = [1, 2, 3] B = [1, 2, 5] C = A union B = [1, 2, 3, 5] How can I…
Manika Sharma
  • 113
  • 1
  • 12
1
vote
1 answer

Expected-Got CLOB datatype

I stuck in one problem and I have no idea what to do. In my table I have column type CLOB and in my SELECT I use this column and I can not remove from select statement. Somehow I try to change it to VARCHAR(255) but my table contains data and backup…
user5775469