What MySQL data type suits best for storing average rating values, like movie ratings on IMDB? FLOAT, DECIMAL? Or maybe it will work faster if I round actual values to two decimal places in PHP and save it like INT (8.323243 -> 8.32 -> 832)?
How to store average rating in MySQL?
2k views Asked by Kadilov At
2
There are 2 answers
0
Sjoerd
On
You don't care about precision, so it is not necessary to use decimal. If you want to only use whole numbers, use an int. Else, use a float or double.
Rounding it first in PHP gains you nothing. Converting it in PHP between int and double will be slower than storing doubles in the database.
Related Questions in MYSQL
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to change woocomerce or full wordpress currency with value from USD to AUD
- window.location.href redirects but is causing problems on the webpage
- Error: local variable 'bramka' referenced before assignment
- Products aren't displayed after fetching data from mysql db (node.js & express)
- status table for all entries (even in different dates) in database changing value when all checkboxes are checked
- Can't Fix Mariadb & Mysql ERROR 2002 (HY000): Can't connect to local server through socket '/tmp/mysql.sock' (2) On MacOs
- Express Mysql getting max ID from table not working cought in a promise
- failed to upload a table from sql file
- Update a MySQL row depending on the ID in Google Sheets Apps Script
- Use row values from another table to select them as columns and establish relations between them (pivot table)
- SQL: Generate combination table based on source and destination column from same table
- How to display the column names which have only unique non-null values in MySQL table?
- mysql query takes too long because of wrong indexes usage
- Multitable joining in Sql
Related Questions in FLOATING-POINT
- Imprecision in float integers in C
- printf floating-point output variations only with alpine docker on Windows
- Is it possible to represent -3/32 as a binary floating-point value using only 7 bits
- Pytorch sum problem (possibly floating point)
- Example of Code with and without strictfp Modifier
- Why does numpy's `2**np.array([64])` produces 0, whereas plain python's 2**64 gives the correct result?
- How does floating-point addition work in "np.finfo(np.float64).max + 1"?
- Problem caused by FP16 group quantization on vit-tiny
- How to format float to omit zeros at the end of the fraction
- TypeError: Cannot cast array data from dtype('O') to dtype('float64') according to the rule 'safe' again
- Why wont variables in the list print to 3 decimal places?
- How to print all the decimals of a float 128 to the console
- How to specify a float/decimal value for a column inside an insert in liquibase changelog?
- Why does gcc -O1 affects std::rint()?
- Sign of result of addition in floating point arithmetic
Related Questions in DECIMAL
- How to restrict EditText decimals to two? (Android studio/Kotlin)
- decimal128 ieee 754 combination/exponent
- Decimal to Binary program not working on my local machine but works perfectly on online compiler
- How do CAD applications handle out-of-range characters in SHX fonts?
- Ensure numeric display always has 2 decimal places
- Keeping Large Decimal to multiply with Float Pandas
- How to specify a float/decimal value for a column inside an insert in liquibase changelog?
- Data type mismatch in criteria expression for decimal with OleDbCommand
- Convert decimal to string with at least a zero for integer value in C#
- libdecnumber: decSingle vs decDouble/decQuad
- Conversation Index Child Block breakdown
- Stylization of decimals as uppercase in WooCommerce only in Single Product and Product Archive Pages
- Regex that finds both integers, decimals, and thousands separators
- Does 1. == 1.0 in numpy and pytorch?
- How do I get the value of a column to have a decimal length of 3 in sqlite3?
Related Questions in RATING
- Stars rated selection in an Angular Project
- What is the real names of the User rating column from SharePoint Online and how to retrieve using REST
- Ruby on Rails collection_radio_buttons for Star Rating issue with error check
- MUI Rating Custom Tooltip to increase the rendering performance
- Inter-rater reliability or agreement based on Likert scale
- Redundancy in comparison sort / tournament systems
- Salesforce quote rate rating
- Displaying rating with given value from model in list and painting colors dynamically
- How do I sort products by number of reviews and number of positive and negative reviews?
- The named parameter 'child' is required, but there's no corresponding argument. Try adding the required argument
- SKStoreReviewController block the current view
- How to get average rating and reviews for custom taxonomy?
- How display Average Ratings on several pages in Django
- Implement Star Rating for every element inside a html table, which is generated by User Inputs
- Why aren't my Guidewire rating overrides being applied/copied to reinstatement transactions?
Related Questions in RATING-SYSTEM
- How to distinguish different checkboxes in html/css
- Getting value of active/checked rating
- How can I get the star ratign system to display the stars correctly in javascript
- Star rating only rates upto 4 stars
- Get the average selected value of x number of separate select fields
- rating component returns "undefined" (javascript)
- useState resets to init state in CRUD function when edit - ReactStars Component
- ReactStars component can't set useState - calls TypeError: Cannot read properties of undefined (reading 'name')
- CodeIgniter4: Like or dislike feature allows both but want to limit one vote per user
- Ajax Star rating system not storing data to database
- How can I show a star rating based on the average?
- Knockoutjs star rating css
- CodeIgniter 4: Like and Dislike Functionality
- Rating system in web application
- Woocommerce display Reviews and Ratings by tags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
The most performant, fast and small data type will indeed be
INT. Sorting, searching, etc. will be the best with this data type, vs.decimaland/orfloat.