From the course: MySQL Essential Training

Unlock this course with a free trial

Join today to access over 23,700 courses taught by industry experts.

Simple trigonometry

Simple trigonometry

- [Bill] Hi, I'm Bill Wyman. My SQL provides some simple functions for basic trigonometry purposes. Arguments are always in radians, so I can say select the sine of two radians, and I get that number. If I want to provide an argument in degrees, of course, there's two pi radians in a circle. So if you want to use degrees, just multiply by pi over 180. So I can say 45 degrees times pi over 180, and I get the sine of 45 degrees. I can get an arc sine with ASIN and, say, .2 for the argument. I can get a cosine, say, the cosine of pi. It's minus one, or I can get an arc cosine, say, .5. I can get tangents, tangent of pi, or I can get an arc tangent, and we'll give it an argument of two, or I can get a cotangent, say 12. These simple functions provide most of the common trigonometry operators.

Contents