<p class="wp-block-paragraph">à¹à¸à¸°à¸à¸³ 4 à¸à¸³à¸ªà¸±à¹à¸à¹à¸ MySQL à¸à¸µà¹à¸à¸³à¹à¸à¹à¸à¹à¸¥à¸°à¸à¹à¸à¸à¹à¸à¹à¹à¸à¹à¸à¸²à¸à¸à¸¢à¹à¸²à¸à¹à¸à¹à¸à¸à¸ à¸à¸£à¹à¸à¸¡à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹à¸à¸²à¸à¸à¸²à¸¡à¸à¹à¸²à¸à¸¥à¹à¸²à¸à¸à¸£à¸±à¸</p>



<p class="wp-block-paragraph"><strong>COUNT</strong> à¸à¸·à¸à¸à¸²à¸£à¸à¸±à¸ row หรืà¸à¸à¸±à¸à¹à¸à¸§à¸§à¹à¸²à¸¡à¸µà¸à¸³à¸à¸§à¸à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸à¹à¸²à¹à¸«à¸£à¹ </p>



<p class="wp-block-paragraph">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹à¸à¸²à¸ count à¹à¸à¸à¸²à¸£à¸à¸±à¸à¸à¸³à¸à¸§à¸à¸ªà¸´à¸à¸à¹à¸²à¸à¸±à¹à¸à¸«à¸¡à¸à¹à¸à¸à¸²à¸£à¸²à¸ products</p>



<pre class="wp-block-code"><code lang="sql" class="language-sql">SELECT <strong>COUNT</strong>(id) AS product_total FROM products</code></pre>



<p class="wp-block-paragraph"><br><strong>MAX</strong> à¸à¸·à¸à¸à¸²à¸£à¸«à¸² row à¸à¸µà¹à¸¡à¸µà¸à¹à¸²à¸ªà¸¹à¸à¸ªà¸¸à¸à¸à¸²à¸ Field à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸£à¸°à¸à¸¸ </p>



<p class="wp-block-paragraph">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹à¸à¸²à¸ MAX à¹à¸à¸à¸²à¸£à¸«à¸²à¸ªà¸´à¸à¸à¹à¸²à¸à¸µà¹à¸£à¸²à¸à¸²à¸ªà¸¹à¸à¸à¸µà¹à¸ªà¸¸à¸</p>



<pre class="wp-block-code"><code lang="sql" class="language-sql">SELECT <strong>MAX</strong>(price) AS max_price FROM products</code></pre>



<p class="wp-block-paragraph"><br><strong>MIN</strong> à¸à¸·à¸à¸à¸£à¸à¸à¹à¸²à¸¡à¸à¸±à¸ MAX à¹à¸à¹à¸à¸à¸²à¸£à¸«à¸² row à¸à¸µà¹à¸¡à¸µà¸à¹à¸²à¸à¹à¸à¸¢à¸à¸µà¹à¸ªà¸¸à¸à¸à¸²à¸ Field à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸£à¸°à¸à¸¸</p>



<p class="wp-block-paragraph">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹ MIN à¹à¸à¸à¸²à¸£à¸«à¸²à¸ªà¸´à¸à¸à¹à¸²à¸à¸µà¹à¸£à¸²à¸à¸²à¸à¸¹à¸à¸à¸µà¹à¸ªà¸¸à¸</p>



<pre class="wp-block-code"><code lang="sql" class="language-sql">SELECT <strong>MIN</strong>(price) AS min_price FROM products</code></pre>



<p class="wp-block-paragraph"><br><strong>SUM</strong> à¸à¸·à¸à¸à¸²à¸£à¸£à¸§à¸¡ หรืà¸à¸à¸§à¸à¸à¹à¸²à¸à¹à¸à¸¡à¸¹à¸¥ row à¸à¸²à¸ Field à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸£à¸°à¸à¸¸</p>



<p class="wp-block-paragraph">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹à¸à¸³à¸ªà¸±à¹à¸ SUM à¹à¸à¸·à¹à¸à¸à¸¹à¸¡à¸¹à¸¥à¸à¹à¸²à¹à¸à¸¢à¸£à¸§à¸¡à¸à¸à¸à¸ªà¸´à¸à¸à¹à¸²à¹à¸à¸à¸²à¸£à¸²à¸ products</p>



<pre class="wp-block-code"><code lang="sql" class="language-sql">SELECT <strong>SUM</strong>(price) AS sum_price FROM products</code></pre>



<p class="wp-block-paragraph"><br><strong>AVG</strong> à¸à¸·à¸à¸à¸²à¸£à¸«à¸²à¸à¹à¸²à¹à¸à¸¥à¸µà¸¢à¸à¸à¸à¸à¹à¸à¸¡à¸¹à¸¥ row à¸à¸²à¸ Field à¸à¹à¸à¸¡à¸¹à¸¥à¸à¸µà¹à¸£à¸°à¸à¸¸</p>



<p class="wp-block-paragraph">à¸à¸±à¸§à¸à¸¢à¹à¸²à¸à¸à¸²à¸£à¹à¸à¹à¸à¸³à¸ªà¸±à¹à¸ AVG à¹à¸à¸·à¹à¸à¸à¸¹à¸§à¹à¸²à¸£à¸²à¸à¸²à¸à¸à¸à¸ªà¸´à¸à¸à¹à¸²à¹à¸à¸à¸²à¸£à¸²à¸ products à¸à¸±à¹à¸à¸«à¸¡à¸à¸à¸±à¹à¸à¹à¸à¸¢à¹à¸à¸¥à¸µà¹à¸¢à¹à¸¥à¹à¸§à¸£à¸²à¸à¸²à¸à¸¢à¸¹à¹à¸à¸µà¹à¸à¸£à¸°à¸¡à¸²à¸à¹à¸à¹à¸²à¹à¸«à¸£à¹</p>



<pre class="wp-block-code"><code lang="sql" class="language-sql">SELECT <strong>AVG</strong>(price) AS avg_price FROM products</code></pre>



<p class="wp-block-paragraph"></p>

MySQL การใช้งานคำสั่ง MAX,MIN,COUNT,SUM,AVG

MySQL-การใช้งานคำสั่ง-MAX-MIN-COUNT-SUM-AVG
