Here I mainly discuss the following SELECT statements:
The Doo_archive table is a data table with rows of 4 rows, as follows:
use three SELECT statements, select 1 from doo_archive,Select COUNT (1) from doo_archive,Select The sum (1) from doo_archive is tested and the results are as follows:
1: Test results, draw a line number and doo_archive A temporary column with the same number of table rows, the column value for each row is 1, as follows:
2: Draw a number, the number is doo_archive the number of rows in the table is 4, as follows:
3: Draw a number, the number is doo_archive the number of rows in the table is 4, as follows:
Then I used select 2 from doo_archive, select COUNT (2) from doo_archive, select SUM (2) from the doo_archive test, The results are as follows:
1: Get a temporary column of the same number of rows and doo_archive table rows, the column value of each row is 2;
2: A number is obtained, which is the number of rows in the doo_archive table;
3: A number is obtained, which is the number of rows X2 of the doo_archive table.
Then I use select from doo_archive, select COUNT (Ten) from Doo_archive, select SUM (Ten) from Doo_archive Test:
1: Draw a temporary column (10) with the same number of rows as the doo_archive table row, and the column value for each row (10) is the number I write after the select;
2: A number is still obtained, which is the number of rows in the doo_archive table (4);
3: Draw a number that is the number of rows (4) x of the doo_archive table (10), or 40, that is written in the select.
In summary: I found that the first way to write is to increase the temporary column, the column value of each row is written in the number of select, the second is that regardless of how a value of count (a) changes, the resulting value is always the number of rows of table tables;
What does 1 in the Select 1 from table statement mean?