
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Implement Harmonic mean and Quadratic mean in MySQL?
Let us first create a table −
mysql> create table DemoTable1606 -> ( -> Value int -> ); Query OK, 0 rows affected (0.55 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1606 values(5); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1606 values(10); Query OK, 1 row affected (0.12 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1606;
This will produce the following output −
+-------+ | Value | +-------+ | 5 | | 10 | +-------+ 2 rows in set (0.00 sec)
Here is the query to implement Harmonic mean and Quadratic mean in MySQL −
mysql> select (count(*)/sum(1/Value)) as HarmonicMean, -> sqrt(sum(Value * Value)/count(*)) as QuadraticMean -> from DemoTable1606;
This will produce the following output −
+--------------+-------------------+ | HarmonicMean | QuadraticMean | +--------------+-------------------+ | 6.6667 | 7.905694150420948 | +--------------+-------------------+ 1 row in set (0.03 sec)
- Related Articles
- Find Harmonic mean using Arithmetic mean and Geometric mean using C++.
- Program for harmonic mean of numbers in C++
- Swift Program to Find Harmonic Mean of the Numbers
- Implement mean shift algorithm in Python
- C++ Program to implement standard error of mean
- What does INT(7) in MySQL mean?
- What do column flags mean in MySQL Workbench?
- What does the KEY keyword mean in MySQL?
- What does parenthesis mean in MySQL SELECT (COLNAME)?
- What does “unsigned” in MySQL mean and when to use it?
- What does the slash mean in a MySQL query?
- Mean and Mode in SQL Server
- Plot mean and standard deviation in Matplotlib
- Arithmetic Mean in c++?
- What is mean ?

Advertisements