From 2a754f96ccf1df62224c5dfdb87fa7217fa7c319 Mon Sep 17 00:00:00 2001 From: cslylla <81328857+cslylla@users.noreply.github.com> Date: Thu, 8 Jun 2023 12:31:46 +0200 Subject: [PATCH 1/6] Create folder and file with template --- .../math-functions/terms/log10/log10.md | 52 +++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 content/sql/concepts/math-functions/terms/log10/log10.md diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md new file mode 100644 index 00000000000..b555e3554bd --- /dev/null +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -0,0 +1,52 @@ +--- +Title: 'LOG10()' +Description: 'Rounds up a numeric value to the next highest integer.' +Subjects: + - 'Data Science' + - 'Computer Science' +Tags: + - 'SQL' + - 'MySQL' + - 'PostgreSQL' + - 'SQLite' + - 'Functions' +CatalogContent: + - 'learn-sql' + - 'paths/analyze-data-with-sql' +--- + +The SQL function **`LOG10()`** is used to round up a numeric value to the next highest integer. It returns the next whole value that is greater than or equal to the input value. + +## Syntax + +```sql +SELECT LOG10(value) +FROM table_name; +``` + +- `value` - This is the value to be rounded up. + +## Example + +The following data is given in a `temperatures` table: + +| temp_id | raw_temp | +| ------- | -------- | +| 1 | 30.25 | +| 2 | 9.95 | +| 3 | -5.7 | + +The `LOG10()` function can be used to round up the raw temperatures: + +```sql +SELECT temp_id, LOG10(raw_temp) AS ceil_temp +FROM temperatures; +``` + +The output will be: + +| temp_id | ceil_temp | +| ------- | --------- | +| 1 | 31 | +| 2 | 10 | +| 3 | -5 | From c9303a7dc5cbeba55ec94d7d4ecc9dd16bd25652 Mon Sep 17 00:00:00 2001 From: cslylla <81328857+cslylla@users.noreply.github.com> Date: Mon, 19 Jun 2023 11:50:56 +0200 Subject: [PATCH 2/6] Review --- .../math-functions/terms/log10/log10.md | 44 +++++++++++-------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md index b555e3554bd..ec10ea08939 100644 --- a/content/sql/concepts/math-functions/terms/log10/log10.md +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -1,6 +1,6 @@ --- Title: 'LOG10()' -Description: 'Rounds up a numeric value to the next highest integer.' +Description: 'Calculates the base-10 logarithm of a number.' Subjects: - 'Data Science' - 'Computer Science' @@ -15,38 +15,44 @@ CatalogContent: - 'paths/analyze-data-with-sql' --- -The SQL function **`LOG10()`** is used to round up a numeric value to the next highest integer. It returns the next whole value that is greater than or equal to the input value. +The **`LOG10()`** SQL function calculates the base-10 logarithm of a number. ## Syntax ```sql -SELECT LOG10(value) -FROM table_name; +LOG10(number) ``` -- `value` - This is the value to be rounded up. +The `LOG10()` function takes one required parameter, `number`: + +- a `float` type number greater than `0`, or +- an expression resulting in a `float` type number (e.g. `EXP(10)` or `10*10`). + +The `LOG10()` function returns the base-10 logarithm of `number` as a `float`. + +> **Note:** The `LOG10()` function is compatible with various SQL database systems such as MySQL, PostgreSQL, SQL Server and Oracle. ## Example -The following data is given in a `temperatures` table: +The table below, called `POWER_OF_TEN`, contains powers of `10`: -| temp_id | raw_temp | -| ------- | -------- | -| 1 | 30.25 | -| 2 | 9.95 | -| 3 | -5.7 | +| num_id | num_10 | +| ------- | ------------ | +| 1 | 1 | +| 2 | 10 | +| 3 | 100 | -The `LOG10()` function can be used to round up the raw temperatures: +The `LOG10()` function can calculate the base-10 logarithm of each number in the `POWER_OF_TEN` table: ```sql -SELECT temp_id, LOG10(raw_temp) AS ceil_temp -FROM temperatures; +SELECT num_id, LOG10(num_10) AS num_log10 +FROM POWER_OF_TEN; ``` -The output will be: +This example results in the following output: -| temp_id | ceil_temp | +| num_id | num_log10 | | ------- | --------- | -| 1 | 31 | -| 2 | 10 | -| 3 | -5 | +| 1 | 0 | +| 2 | 1 | +| 3 | 2 | From f055bb9b56b81940ba2b4428ee1678e6adb0b87a Mon Sep 17 00:00:00 2001 From: Lilla <81328857+cslylla@users.noreply.github.com> Date: Thu, 22 Jun 2023 12:14:09 +0200 Subject: [PATCH 3/6] Update content/sql/concepts/math-functions/terms/log10/log10.md Co-authored-by: Christine Belzie <105683440+CBID2@users.noreply.github.com> --- content/sql/concepts/math-functions/terms/log10/log10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md index ec10ea08939..ab85569426f 100644 --- a/content/sql/concepts/math-functions/terms/log10/log10.md +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -49,7 +49,7 @@ SELECT num_id, LOG10(num_10) AS num_log10 FROM POWER_OF_TEN; ``` -This example results in the following output: +The above example results in the following output: | num_id | num_log10 | | ------- | --------- | From bf62a2bbe03c8df55a8e7029b8183730022a57d3 Mon Sep 17 00:00:00 2001 From: Lilla <81328857+cslylla@users.noreply.github.com> Date: Thu, 22 Jun 2023 12:15:43 +0200 Subject: [PATCH 4/6] Update content/sql/concepts/math-functions/terms/log10/log10.md Co-authored-by: caupolicandiaz --- content/sql/concepts/math-functions/terms/log10/log10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md index ab85569426f..1d7920e3aff 100644 --- a/content/sql/concepts/math-functions/terms/log10/log10.md +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -25,7 +25,7 @@ LOG10(number) The `LOG10()` function takes one required parameter, `number`: -- a `float` type number greater than `0`, or +- A `float` type number greater than `0`. - an expression resulting in a `float` type number (e.g. `EXP(10)` or `10*10`). The `LOG10()` function returns the base-10 logarithm of `number` as a `float`. From 1986e867cde4ff6128dc4e9e038ac34f5272f66c Mon Sep 17 00:00:00 2001 From: Lilla <81328857+cslylla@users.noreply.github.com> Date: Thu, 22 Jun 2023 12:15:50 +0200 Subject: [PATCH 5/6] Update content/sql/concepts/math-functions/terms/log10/log10.md Co-authored-by: caupolicandiaz --- content/sql/concepts/math-functions/terms/log10/log10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md index 1d7920e3aff..b696cc6ea33 100644 --- a/content/sql/concepts/math-functions/terms/log10/log10.md +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -26,7 +26,7 @@ LOG10(number) The `LOG10()` function takes one required parameter, `number`: - A `float` type number greater than `0`. -- an expression resulting in a `float` type number (e.g. `EXP(10)` or `10*10`). +- An expression resulting in a `float` type number (e.g. `EXP(10)` or `10*10`). The `LOG10()` function returns the base-10 logarithm of `number` as a `float`. From fc8fae9f8b87133e1bc412c91431acd589362d41 Mon Sep 17 00:00:00 2001 From: SSwiniarski <86081858+SSwiniarski@users.noreply.github.com> Date: Sat, 1 Jul 2023 11:04:39 -0400 Subject: [PATCH 6/6] prettier formatting --- .../math-functions/terms/log10/log10.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/content/sql/concepts/math-functions/terms/log10/log10.md b/content/sql/concepts/math-functions/terms/log10/log10.md index b696cc6ea33..763c59151c3 100644 --- a/content/sql/concepts/math-functions/terms/log10/log10.md +++ b/content/sql/concepts/math-functions/terms/log10/log10.md @@ -36,11 +36,11 @@ The `LOG10()` function returns the base-10 logarithm of `number` as a `float`. The table below, called `POWER_OF_TEN`, contains powers of `10`: -| num_id | num_10 | -| ------- | ------------ | -| 1 | 1 | -| 2 | 10 | -| 3 | 100 | +| num_id | num_10 | +| ------ | ------ | +| 1 | 1 | +| 2 | 10 | +| 3 | 100 | The `LOG10()` function can calculate the base-10 logarithm of each number in the `POWER_OF_TEN` table: @@ -51,8 +51,8 @@ FROM POWER_OF_TEN; The above example results in the following output: -| num_id | num_log10 | -| ------- | --------- | -| 1 | 0 | -| 2 | 1 | -| 3 | 2 | +| num_id | num_log10 | +| ------ | --------- | +| 1 | 0 | +| 2 | 1 | +| 3 | 2 |