This article is half-done without your Comment! *** Please share your thoughts via Comment ***
What happens when you reach maximum value for AUTO_INCREMENT field?
It stops the incrementing and generate an error like, the key is already in use.
Using which command, you can get the last inserted id by AUTO_INCREMENT?
LAST_INSERT_ID will return the last value assigned by Auto_increment.
Command to check indexes for a table.
SHOW INDEX FROM <table_name>;
Is Mysql query is case sensitive?
No:
Explain any three date function of MySQL.
DATEDIFF(expr1,expr2):
DATEDIFF() returns expr1 − expr2 expressed as a value in days from one date to the other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation.
1 2 3 4 |
mysql> SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30'); -> 1 mysql> SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31'); -> -31 |
ADDDATE(date,INTERVAL expr unit), ADDDATE(expr,days)
1 2 3 4 5 |
mysql> SELECT ADDDATE('2008-01-02', INTERVAL 31 DAY); -> '2008-02-02' mysql> SELECT ADDDATE('2008-01-02', 31); -> '2008-02-02' |
EXTRACT(unit FROM date)
It extracts parts from the date rather than performing date arithmetic.
1 2 3 4 |
mysql> SELECT EXTRACT(YEAR FROM '2009-07-02'); -> 2009 mysql> SELECT EXTRACT(YEAR_MONTH FROM '2009-07-02 01:02:03'); -> 200907 |
Explain any three string function of MySQL.
How you can perform pagination in MySQL Query?
Using LIMIT and OFFSET.
You can skip some number of rows by OFFSET and set the LIMIT for the next number of rows.
What is the difference between NOW() and CURRENT_DATE()?
NOW() format : YYYY-MM-DD HH:MM:SS
CURRENT_DATE() format: YYYY-MM-DD