English 中文(简体)
这种简单的询问意味着什么?
原标题:What does this simple query mean?
  • 时间:2012-04-23 16:46:20
  •  标签:
  • mysql

我正在研究以下重要观点:

CREATE MATERIALIZED VIEW ShipStats AS
SELECT country, AVG(displacement), COUNT(*)
FROM classes, ships
WHERE classes.class = ships.name
GROUP BY country;

并试图说明选任考试委员会的部分工作。

我理解选定国家。 而AVG(安置)是流离失所一栏的平均数。 但是,COUNT(*)做些什么。 而AVG的流离失所与单一船舶的统计有关?

Relations:

Classes(class, type, country, numGuns, bore, displacement)
Ships(name, class, launched)
最佳回答

www.un.org/Depts/DGACM/index_french.htm

由于group by statement,该国的所有行文均并入单一行。

因此,流离失所不是单船,而是一批船舶。

如果只有一行进入这一组,<代码>count将返还1,average将返还该行的流离失所价值。

问题回答

它选择了该国,登记到该国的船只平均流离失所,以及登记到该国的船只数目(至少假设列名与现实一致)。

页: 1

它计算了该组项目的数量。 但我认为,这还包括民族解放军的价值观和重复。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签