This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Date and Time Data Types”.
1. Which of these has special automatic update behavior?
Explanation: The date and time types for representing temporal values are ‘DATE’, ‘TIME’, ‘DATETIME’, ‘TIMESTAMP’ and ‘YEAR’. Each temporal type has a range of valid values and a ‘zero’ value.
2. To disallow zero month or day parts in dates, the option used is _____________
Explanation: MySQL permits to store the dates where the day or month and day are zero in a DATE or DATETIME column. This is helpful for applications that need to store birthdates for which the exact date is unknown.
3. The mode that does not remove trailing spaces when CHAR values are retrieved is _____________
Explanation: When the CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed unless the SQL mode ‘PAD_CHAR_TO_FULL_LENGTH’ is enabled.
4. MySQL automatically converts a date or time value to a number if the value is used in a numeric context.
Explanation: MySQL automatically converts a date or time value into a number if the value is used in a numeric context and vice versa. A ‘zero’ value can also be represented in MySQL.
5. The functions in Perl DBI called?
Explanation: In the DBI API, functions are called and pointers to structures are used. The functions are called ‘methods’, pointers are called ‘references’, pointer variables are called ‘handles’.
6. The variable used as a handle to an open file is ______________
Explanation: The variable named ‘$fh’ is a handle to an open file. ‘$h’ is a generic handle and the meaning depends on context. ‘$dbh’ is a handle to a database object. ‘$sth’ is a handle to a query object.
7. Which variable is a handle to a database object?
Explanation: The variable named ‘$dbh’ is a handle to an open file. ‘$h’ is a generic handle and the meaning depends on context. ‘$dbh’ is a handle to a database object. ‘$sth’ is a handle to a query object.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.