DBA > Interview Resource

MySQL and SQL

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45 

(Continued from previous part...)

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.


What happens if a table has one column defined as TIMESTAMP?

That field gets the current timestamp whenever the row gets altered.


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.


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.


What does TIMESTAMP ON UPDATE CURRENT_TIMESTAMP data type do?

On initialization places a zero in that column, on future updates puts the current value of the timestamp in.


Explain TIMESTAMP DEFAULT ‘2006:09:02 17:38:44? ON UPDATE CURRENT_TIMESTAMP.

A default value is used on initialization, a current timestamp is inserted on update of the row.


If I created a column with data type VARCHAR(3), what would I expect to see in MySQL table?

CHAR(3), since MySQL automatically adjusted the data type.

(Continued on next part...)

Part:   1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25  26  27  28  29  30  31  32  33  34  35  36  37  38  39  40  41  42  43  44  45