Category Archives: MySql Interview Questions

How To Get a List of Indexes of an Existing Table? | MySql Questions

If you want to see the index you have just created for an existing table, you can use the “SHOW INDEX FROM tableName” command to get a list of all indexes in a given table. The tutorial script below shows … Continue reading

Posted in MySql Interview Questions | Leave a comment

How To Create a Table Index in MvSQL? | MySql Questions

If you have a table with a lots of rows, and you know that one of the columns will be used often as a search criteria, you can add an index for that column to improve the search performance. To … Continue reading

Posted in MySql Interview Questions | Leave a comment

How To Rename an Existing Table in MySQL? | MySql Questions

ALTER TABLE tip RENAME TO faq;

Posted in MySql Interview Questions | Leave a comment

Flow To Rename an Existing Column in a Table? | MySql Questions

ALTER TABLE tip CHANGE COLUMN subject title VARCHAR(60);

Posted in MySql Interview Questions | Leave a comment

How To Delete an Existing Column in a Table? | MySql Questions

ALTER TABLE tip DROP COLUMN create_date; Query OK, 1 row affected (0.48 sec) Records: 1 Duplicates: 0 Warnings: 0

Posted in MySql Interview Questions | Leave a comment

How To Add a New Column to an Existing Table in MySQL? | MySql Questions

ALTER TABLE tip ADD COLUMN author VARCHAR(40); Query OK, 1 row affected (0.18 sec) Records: 1 Duplicates: 0 Warnings: 0

Posted in MySql Interview Questions | Leave a comment

Flow To Present a Past Time in Hours, Minutes and Seconds? | MySql Questions

If you want show an article was posted “n hours n minutes and n seconds ago’, you can use the TIMEDIFF(NOWO, pastTime) function as shown in the following tutorial exercise: SELECT TIMEDIFF(NOWO, ‘2006-07-01 04:09:49’) FROM DUAL; 06:42:58 SELECT TIM E_FORMAT(TI … Continue reading

Posted in MySql Interview Questions | Leave a comment

How To Calculate the Difference between Two Dates? | MySql Questions

If you have two dates, and you want to know how many days between them, you can use the DATEDIFF(datel, date2) function as shown below: SELECT DATEDI FF( DATE(’1997-02-28’), DATE(’1997-03-01’)) FROM DUAL; -1 and different between two time is TIMEDIFF()

Posted in MySql Interview Questions | Leave a comment

How To Increment Dates by 1111 MvSQL? | MySql Questions

If you have a date, and you want to increment it by 1 day, you can use the DATE_ADD(date, INTERVAL 1 DAY) function. You can also use the date interval add operation as “date + INTERVAL 1 DAY. The tutorial … Continue reading

Posted in MySql Interview Questions | Leave a comment

How To Use LIKE Conditions? | MySql Questions

A LIKE condition is also called pattern patch. There are 3 main rules on using LIKE condition: * is used in the pattern to match any one character. * % is used in the pattern to match any zero or … Continue reading

Posted in MySql Interview Questions | Leave a comment