Website logo
⌘K
🏠Homepage
👋Introduction
Key Concepts & Architecture
🚀Run Oxla in 2 minutes
🏃‍♂️Run Oxla on S3
🛫Multi-node Deployment
👨‍💻SQL Reference
SQL Queries
SQL Clauses
SQL Data Types
SQL Functions
Schema
Comment Support
⛓️SQL Mutations
DELETE
UPDATE
🚨Error Handling
🆚Differences Between Oxla vs. PostgreSQL
🔄Understanding Transactions
📈Public Metrics
⚙️Oxla Configuration File
✨Changelog
Docs powered by Archbee
SQL Reference
...
SQL Functions
Numeric Functions

SIN

10min

Overview

SIN() is a numeric function that returns the trigonometric sine value of a specified angle in radians.

Syntax

The syntax of the SIN() function is as follows.

Syntax
SIN (x)


The SIN() function requires one argument:

x:  A positive or a negative angle (or an expression that evaluates to an angle).

Examples

Case #1: Sine a Positive Value

The example below will use the SIN() function with a positive angle as the argument.

Select sin
SELECT SIN(5);


It will return the sine value of 5.

Output
+-----------------------+
| f                     |
+-----------------------+
| -0.9589242746631385   |
+-----------------------+


Case #2: Sine a Negative Value

The following example shows the SIN() function with a negative angle as the argument.

Select sin
SELECT SIN(-3);


The output will be as follows.

Output
+----------------------+
| f                    |
+----------------------+
| -0.1411200080598672  |
+----------------------+


Case #3: Sine a Fraction Value

The following example shows the SIN() function with a fractional value as the argument.

Select sin
SELECT SIN(5.8732);


The output will be as follows.

Output
+----------------------+
| f                    |
+----------------------+
| -0.3985959081271079  |
+----------------------+


Case #4: Sine With an Expression

The SIN() function can also include an expression, as shown in the example below:

Select sin
SELECT sin(8.5 * 2.3);


You will get the following output:

Output
+-----------------------+
| f                     |
+-----------------------+
| 0.6445566903363104    |
+-----------------------+


Case #5: Using the SIN() Function With a Table

In the following example, we will combine SIN() function with CREATE TABLE query to obtain the sine values of a specific column.

1) Create a new table named sineTable containing the initialValue column. Input some values with the negative and positive angles into the column.

Create a table
CREATE TABLE sineTable(initialValue int);
INSERT INTO sineTable(initialValue)
VALUES (-5),(18), (0),(-27);


2) Run the query below to get the output of a sine value:

Select sin
SELECT * ,SIN(initialValue) AS sinValue FROM sineTable;


3) The final result will have the initialValue column with the source value and the sinValue column with their calculated sine values.  

Output
+---------------+-------------------------------+
| initialvalue  | sinValue                      |
+---------------+-------------------------------+
| -75           | 0.38778163540943045           |
| 180           | -0.8011526357338304           |
| 0             | 0                             | 
| -270          | 0.1760459464712114            |
+---------------+-------------------------------+




Updated 09 Oct 2023
Did this page help you?
PREVIOUS
LN
NEXT
LEAST
Docs powered by Archbee
TABLE OF CONTENTS
Overview
Syntax
Examples
Case #1: Sine a Positive Value
Case #2: Sine a Negative Value
Case #3: Sine a Fraction Value
Case #4: Sine With an Expression
Case #5: Using the SIN() Function With a Table
Docs powered by Archbee

©2023 Oxla