I am some questions about Char and Varchar when I am preparing MySQL administrator test.
1.Suppose you have a column in which most records are going to be between 30 and 32 characters.
Which of the following column types would be most efficient?
D. Either VARCHAR or CHAR
I don't know why answer would be Char. Since Char will use Char(32), Varchar will use 30 characters plus 1 byte or 31 characters plus 1 byte or 32 character plus 1 byte. There isn't much difference, so I think either Varchar or Char will work.
QUESTION NO: 29
You are using a multi-byte character set with variable-length encoding. You need to store records
whose values are always 20 characters. Which of the following column types would be the most
efficient to use in terms of storage space?
C. The storage requirements for CHAR or VARCHAR would be the same
Since Varchar will take one extra byte for store the length. I thought no doubt should pick Char.
QUESTION NO: 30
Another user has gotten a lock using GET_LOCK. You inquire on the status of the lock by using
D. Another GET_LOCK
E. LOCK TABLES
The question is asking for status of the lock. I thought B is more appropriate since IS_FREE_LOCK will return 1 if the name is not locked, 0 if it is locked.
I don't now there answers were messed up or I made some mistakes. Appreciate your comments.