MySQL (pronounced "my ess cue el") is an open source relational database management system (RDBMS) that uses Structured Query Language (SQL), the most popular language for adding, accessing, and processing data in a database. Because it is open source, anyone can download MySQL and tailor it to their needs in accordance with the general public license. MySQL is noted mainly for its speed, reliability, and flexibility
MySQL Interviews are getting tough these days as the technology grows faster. To get through the MySQL interview one needs to update him/herself in a regular manner. Having said that, just before the interview, it is very important to have a quick glance of the reputed MySQL questions and answers to make yourself comfortable during the interview process. This is where DoAnswers.com helps you in renewing yourself on MySQL and various other technologies interview preparation.
21. How do you convert between Unix timestamps and MySQL timestamps?
UNIX_TIMESTAMP converts from MySQL timestamp to Unix timestamp, FROM_UNIXTIME converts from Unix timestamp to MySQL timestamp.
22. How do you display that to the user?
SELECT SQL_CALC_FOUND_ROWS page_title FROM web_pages LIMIT 1,10; SELECT FOUND_ROWS(); The second query (not that COUNT() is never used) will tell you how many results there?re total, so you can display a phrase "Found 13,450,600 results, displaying 1-10". Note that FOUND_ROWS does not pay attention to the LIMITs you specified and always returns the total number of rows affected by query.
23. How do you find out which auto increment was assigned on the last insert?
SELECT LAST_INSERT_ID() will return the last value assigned by the auto_increment function. Note that you don?t have to specify the table name.
24. How do you get a portion of a string?
SELECT SUBSTR(title, 1, 10) from techinterviews_questions;
25. How do you get the month from a timestamp?
SELECT MONTH(techinterviews_timestamp) from techinterviews_questions;
26. How do you get the number of rows affected by query?
SELECT COUNT (user_id) FROM users would only return the number of user_id?s.
27. How do you offload the time/date handling to MySQL?
SELECT DATE_FORMAT(techinterviews_timestamp, ?%Y-%m-%d?) from techinterviews_questions; A similar TIME_FORMAT function deals with time.
28. How do you return the a hundred books starting from 25th?
SELECT book_title FROM books LIMIT 25, 100. The first number in LIMIT is the offset, the second is the number. You wrote a search engine that should retrieve 10 results at a time, but at the same time you?d like to know how many rows there?re total.
29. How do you start and stop MySQL on Windows?
net start MySQL, net stop MySQL
30. How do you start MySQL on Linux?
/etc/init.d/mysql start