How can we extract the Year and Month from a date in MySQL?

Monica Mona
Published on 21-Feb-2018 11:25:08
It can be done with the following three ways in MySQLBy using EXTRACT() function For extracting YEAR and MONTH collectively then we can use the EXTRACT function. We need to provide the YEAR_MONTH as an argument for this function. To understand it, consider the following function using the data from table ... Read More

How to use MySQL Date functions with WHERE clause?

Ankith Reddy
Published on 21-Feb-2018 11:21:00
By using the WHERE clause with any of the MySQL date functions, the query will filter the rows based on the condition provided in the WHERE clause. To understand it, consider the data from ‘Collegedetail’ table as followsmysql> Select * from Collegedetail; +------+---------+------------+ | ID   | Country | Estb ... Read More

How can we use ORDER BY clause while calculating the Date?

Kumar Varma
Published on 21-Feb-2018 11:19:45
It would be more convenient to find a record if we will use ORDER BY clause while calculating the date. To understand it, we have the data from table ‘Collegedetail’ as follows −mysql> Select * from Collegedetail; +------+---------+------------+ | ID   | Country | Estb       | +------+---------+------------+ ... Read More

Do we require any authentication for login into MySQL command line tool?

Prabhas
Published on 21-Feb-2018 11:20:59
Yes, we require authentication for login into MySQL command line tool. For example, if we are trying to log in from windows command line then it will prompt for the password every time. The command for login is as follows −C:\Program Files\MySQL\bin>mysql -u root -p Enter password: *****Read More

How can we calculate the Date in MySQL using functions?

Ayyan
Published on 21-Feb-2018 11:19:05
In MySQL, we can use the following functions to calculate the Date −CURDATE() Function − Basically it returns the current date of the computer.YEAR() Function − It returns the year of the specified date.MONTH() function − It returns the month of the specified date.DAY() Function − It returns the day ... Read More

How can we get an idea about the server performance from the output of MySQL?

vanithasree
Published on 21-Feb-2018 11:16:35
After running a query, MySQL returns the number of rows and gives time in the output that shows how much it took for running that query. As for example, if we run the following querymysql> create table e1(id int); Query OK, 0 rows affected (0.23 sec)It is showing the time ... Read More

How can we get the list of MySQL server-side help categories?

seetha
Published on 21-Feb-2018 11:17:56
We can get the list of MySQL server-side help categories by giving the keyword contents to the help command.mysql> help contents You asked for help about help category: "Contents" For more information, type 'help <item>', where <item> is one of the following categories:    Account Management    Administration    Compound ... Read More

How can we capitalize only first letter of a string with the help of MySQL function/s?

Sharon Christine
Published on 21-Feb-2018 11:14:59
Actually, there is no single function in MySQL to capitalize only first letter of the string. We need to use nesting of functions and for this case, we can use UPPER() and LOWER() with SUBSTRING() functions. To understand it, we are using data, given as below, from ‘emp_tbl’.mysql> Select * ... Read More

How can we get “MySQL server-side help”?

radhakrishna
Published on 21-Feb-2018 11:10:33
MySQL provides help command to get server-side help. The syntax of this command is as follows −mysql> help search_stringMySQL uses the argument of help command as the search string for accessing the contents of MySQL reference manual. The search will fail if there would be no match for the search ... Read More

How can we return to windows command shell from MySQL command line tool?

mkotla
Published on 21-Feb-2018 11:06:58
The EXIT or QUIT commands take you returned to windows from MySQL command line tool.mysql> EXITORmysql> QUIT
Advertisements