Q:

Write a mysql statement to get user, current date and mysql version

belongs to collection: MySQL Exercises

0

Write a mysql statement to get user, current date and mysql version

 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

VERSION() - This function returns the version of the MySQL database.

CURDATE() - This function returns the current date. It returns the current date as a "YYYY-MM-DD" format if string is used in the function, and as a YYYYMMDD format if numeric context is used in a function.

USER() - This function returns the user name and host name for the current MySQL user.

SYSTEM_USER() - This function returns the current user name and host name for the MySQL connection and equal to USER() method.

To know the installed version of MySQL, user and current date run the following command.

SELECT VERSION(), USER(), CURRENT_DATE();

Output of the above code -

 
+-----------+--------------+----------------+
| VERSION() | CURRENT_DATE | USER()         |
+-----------+--------------+----------------+
| 5.7.21    | 2018-06-23   | root@localhost |

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

MySQL Exercises

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
Write a mysql statement to get item id, item, pric... >>
<< Write a mysql statement to find the concatenated f...