MySQL Version, Current User, Current Date

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

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 |
+-----------+--------------+----------------+




Related MySQL Exercises

MySQL concatenate
MySQL Get Maximum Value
MySQL Administrator
MySQL where clause
MySQL order by
MySQL get difference between two dates
MySQL Pattern Matching
MySQL Join
MySQL Regular Expression
MySQL delete duplicate row
MySQL update multiple rows
Get nth highest salary using MySQL
Display the nth row from MySQL
Commit and rollback in mysql
MySQL SELECT top 5
MySQL display the alternate rows




Read more articles


General Knowledge



Learn Popular Language