MySQL: Query Interview Questions and Answers

I require to select 10 records at a time and at the same time I also require to know the total count of records.
How would you do this?

You can use SQL_CALC_FOUND_ROWS in SELECT statement and execute FOUND_ROWS().
Sample query:

The First statement will return your 10 records and second statement will return total count of records.
The FOUND_ROWS() function will not internally use COUNT so it performs better.

Find all database starting with ‘db’.

How to concatenate this two string?
String 1: ‘My name is Anvesh.’
String 2: ‘I am Database Administrator.’

How to get a portion of a string by specifying position?

How to select month from given date?

How to format date in MM-DD-YY format?

How to format date in week – day – month – year format?

How to copy the only table structure and create a new table?

How to make copies of the table with data and structure?

What are the result of below queries?

Result : NULL

Result : 1

Result : NULL

How to convert numeric values to strings?

How to convert string values to Date format?

How to add new column to an existing table?

How to drop column from an existing table?

How to rename a column in an existing table?

How to rename existing Table?

How to drop index of a table?

Check running all MySQL Server Processes.

Command to shutdown MySQL.

Check MySQL current version.

Check MySQL is running or not.

How to list all databases from the MySQL Server?

How to switch or use to a database?

How to list all tables from the MySQL Server?

How to see a description or definition of the Table?

How to find top N records for each group?
Please visit this post:

How to arrange rows to columns Pivot table in MySQL?
Please visit this post:

How to calculate Rank in MySQL Query?
Please visit this post:

How to write Insert-Update, merge statement in MySQL?
Please visit this post:

How to insert a record if not exists in MySQL?
Please visit this post:

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from

Leave a Reply

Be the First to Comment!

Notify of