What type is used in sql for percentage?
I know char, int, numeric, but i don't know what is used for per开发者_如何学Pythoncentage ?
Depends on the database - DECIMAL is the most obvious datatype, with a precision of two. But Oracle doesn't have a DECIMAL data type - it's all just NUMBER, with the ability to specify precision.
What are bigint, point, blob, varbinary used for?
BLOB and VARBINARY are typically one and the same - they're for storing binary content, like files & images.
BIGINT is a large range of integer values. The signed range is -9223372036854775808 to 9223372036854775807. The unsigned range is 0 to 18446744073709551615.
POINT is as I expected - a spatial/geospatial data type, like what you'd use with GPS/etc
Depends on your exact needs. FLOAT or REAL can be used for arbitrary precision. For specified precision, use NUMERIC. If your percentages are calculated to the nearest whole percent, INTEGER is fine.
If your percentages are easily derived from data in your system, consider not storing them in a column but rather defining the calculating in a VIEW and reading from that.
Any of the numeric types will do fine - as NullUserException points out, there's no specific type for percentage.
精彩评论