Difference between revisions of "SIN"
From SQLZOO
(Created page with "<table align='right' border='1'> <caption>Compatibility</caption> <tr><th colspan='3'>SIN(s1 IN s2)</th></tr> <tr><td align='center'>'''Engine'''</td><td align='center'>'''OK'...") |
|||
| (5 intermediate revisions by one user not shown) | |||
| Line 10: | Line 10: | ||
</table> | </table> | ||
<h1>SIN</h1> | <h1>SIN</h1> | ||
| − | <p> | + | <p>SIN(f) returns the sine of f where f is in radians.</p> |
<p></p> | <p></p> | ||
<pre style='width:50ex'> | <pre style='width:50ex'> | ||
| − | + | SIN(3.14159/6) -> 0.5 | |
</pre> | </pre> | ||
| − | + | <div class='ht'> | |
| − | <div class=' | + | <div class=params>schema:scott</div> |
| − | In this example you return the | + | <source lang=sql class='tidy'> DROP TABLE angle</source> |
| + | <source lang=sql class='setup'> CREATE TABLE angle( | ||
| + | id INTEGER, | ||
| + | angle FLOAT); | ||
| + | INSERT INTO angle VALUES (0,1); | ||
| + | INSERT INTO angle VALUES (1,0.7853); | ||
| + | INSERT INTO angle VALUES (2,0.5235); | ||
| + | INSERT INTO angle VALUES (3,1.0471); | ||
| + | </source> | ||
| + | In this example you return the sine of each of the angles. | ||
<source lang='sql' class='def'> | <source lang='sql' class='def'> | ||
| − | SELECT id, | + | SELECT id, angle, SIN(angle) |
| − | + | FROM angle | |
| − | + | ||
</source> | </source> | ||
</div> | </div> | ||
| Line 27: | Line 35: | ||
<p>See also</p> | <p>See also</p> | ||
<ul> | <ul> | ||
| − | <li>[[ | + | <li>[[COS |COS function]]</li> |
| − | <li>[[TAN | + | <li>[[TAN |TAN function]]</li> |
| − | + | ||
</ul> | </ul> | ||
Latest revision as of 09:56, 16 July 2012
| SIN(s1 IN s2) | ||
|---|---|---|
| Engine | OK | Alternative |
| ingres | Yes | |
| mysql | Yes | |
| oracle | Yes | |
| postgres | Yes | |
| sqlserver | Yes | |
SIN
SIN(f) returns the sine of f where f is in radians.
SIN(3.14159/6) -> 0.5
schema:scott
DROP TABLE angle
CREATE TABLE angle( id INTEGER, angle FLOAT); INSERT INTO angle VALUES (0,1); INSERT INTO angle VALUES (1,0.7853); INSERT INTO angle VALUES (2,0.5235); INSERT INTO angle VALUES (3,1.0471);
In this example you return the sine of each of the angles.
SELECT id, angle, SIN(angle) FROM angle
See also