Tag：Difference set

Time：2021713
package services import ( crand “crypto/rand” “errors” “fmt” “github.com/astaxie/beego/orm” “io” “math/rand” “strconv” “strings” “time” ) type UtilService struct { } //uuid func (this *UtilService) Uuid() (string, error) { uuid := make([]byte, 16) n, err := io.ReadFull(crand.Reader, uuid) if n != len(uuid)  err != nil { return “”, err } uuid[8] = uuid[8]&^0xc0  0x80 […]

Time：2021216
Accidentally found that many friends like to use array_ Diff (array1, array2) to determine whether two arrays are equal, I use it occasionally myself But today, in the process of writing code, I found that it was not accurate. First, let’s take a look at the definition of this function (PHP manual) Compare array1 with […]

Time：202128
During the normal work, we may encounter the difference of comparing the contents of two files, and output the different contents of two files. At this time, we can use shell script to operate, use the sort of shell script to sort and then compare. This method is much faster than circular comparison in the […]

Time：2021114
summary Why set operations are used: It is more convenient than join query and exists / not exists in set operation. Union operation Union: the union of two sets is a set that contains all the elements in sets a and B. In TSQL. Union set operation can combine the results of two input queries […]

Time：20201123
In fact, intersection, union, difference and symmetric difference sets are also special operations of sets. A & B: the common element of two sets of intersection table, equivalent to A. intersection (b) A  B: Union table all elements of two sets, equivalent to A. Union (b) AB: elements of difference table belonging to a […]

Time：20201013
Three types of set operations are provided in Oracle: Union, intersect and minus Union: Union,Duplicate records are displayed only once。 Union all: Union all, display all record information. Intersect: find intersection Minus: returns the difference set of two query results Let’s introduce the set operation of Oracle 1、 Data preparation Create emp10 table based […]

Time：2019126
The two field values of Oracle database are comma separated strings, for example, the value of field a is “1,2,3,5”, and the value of field B is “2”. To get the intersection (same value) 2 of two fields, get the difference (difference value) 1,3,5 of two fields. I. the final SQL statement 1. Get intersection […]

Time：201985
There are now two arrays Arr1 and arr2 let arr1 = [1,2,3,4,4] let arr2 = [3,4,5,6,7] 1. The union of arrays: let union = new Set([…arr1,…arr2]) 2. The intersection of arrays let intersect = new Set([…arr1].filter(item => arr2.has(item))) 3. Difference sets of arrays let difference = new Set([…arr1].filter(item => !arr2.has(item)))