Given 2 tables T1 and T2. T1 T2 A 1 B 2 C 3
You make a query SELECT * FROM T1, T2.
What is the no: of rows that are fetched from this query?
Answer 9
This query leads to a Cartesian product , since no other conditions are provided. Each row from the first table is mapped to each row from the second table.
Result
A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 2 C 3
Since each record from the first table is returned along with each record of the second table, and the result is not filtered.
The exact output will be:
T1 T2 A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 2 C 3
(order may vary)
: (3) (3) , 3 * 3 = 9.
This is what you requested. You got all rows from T1and all rows from T2. They are not just combined with each other - it will not work if the columns are different, for example, although you can do it with UNION- they are combined into what is called a “Cartesian product”. You essentially get all row combinations from both tables. And 3*3 = 9.
T1
T2
UNION
3*3 = 9
Source: https://habr.com/ru/post/1785420/More articles:Shift / decrease conflict in yacc due to foreground token restrictions? - parsingI want approval comments to wrap widgets in jQuery - jqueryhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1785417/ggcc-how-to-make-your-app-tell-os-to-download-libs-it-needs-into-system&usg=ALkJrhg9ZUmNHCm72FEWbR9_ndMiSKc6WgHow to create a context menu in MapView? - androidAndroid OnLongClickListener doesn't shoot at MapView - javaPermission Denied in move_uploaded_file to another server in IIS - phpAndroid, copy .png res.raw form file to personal application close - androidfondbox iframe IE rounded corners - jqueryHow to completely clear the git working directory? - gitCopy the PHP file to another server; Accessing the file system on another server - filesystemsAll Articles