木曜日, 3月 26, 2009

MySQL: Counting Rows that Has Same Value

There are many ways to count rows in a database. Here shows grouping the rows and counting them in MySQL database. The keywords are: "group by" to sort out the rows and "as" keyword to set the value to a variable.

Suppose the database has a table 'species' with 'en' field. The "group by" command will set up just one row for each 'en' value. Along with 'en' value, count(en) value will be retrieved in descending order as being set by "order by" command. The results will be a table with representative 'en' value with the count of it.


SELECT en, count( en ) AS cnt
FROM `species`
GROUP BY en
ORDER BY cnt DESC

I2S プロトコル

I²S(Inter-IC Sound)は、マイコンやオーディオ機器間で音声データをやり取りするために設計された、シリアル通信プロトコルです。I²CやSPIと名前は似ていますが、I²Sは音声専用のプロトコルです。 I²Sは、以下の3つの主要な信号線を使って通信します。 BCLK (...