- Home
- Interview Questions
- MySQL
21.
Explain the difference between FLOAT, DOUBLE and REAL.
- FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes. DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes. REAL is a synonym of FLOAT for now.
22.
If you specify the data type as DECIMAL (5,2), what’s the range of values that can go in this table?
- 999.99 to -99.99. Note that with the negative number the minus sign is considered one of the digits.
23.
What happens if a table has one column defined as TIMESTAMP?
- That field gets the current timestamp whenever the row gets altered.
24.
But what if you really want to store the timestamp data, such as the publication date of the article?
- Create two columns of type TIMESTAMP and use the second one for your real data.
25.
Explain data type TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
- The column exhibits the same behavior as a single timestamp column in a table with no other timestamp columns.