Mysql Interview Question and Answers
| 31. |
what is difference between primary key and candidate key? |
| |
Primary Key - are used to uniquely identify each row of the table. A table can have only one primary Key. Candidate Key - primary key is a candidate key. There is no difference. By common convention one candidate key is designated as a “primary” one and that key is used for any foreign key references. |
| 32. |
How do you get the month from a timestamp? |
| |
SELECT MONTH(january_timestamp) from tablename; |
| 33. |
What do % and _ mean inside LIKE statement? |
| |
% corresponds to 0 or more characters, _ is exactly one character. |
| 34. |
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. |
| 35. |
How do you get the current date in Mysql? |
| |
SELECT CURRENT_DATE(); |