DATABASE | MYSQL | MYSQL INTERVIEW QUESTION AND ANSWERS 8 | WHAT IS THE DIFFERENCE BETWEEN MYSQL_FETCH_ARRAY AND MYSQL_FETCH_OBJECT? | 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. HOW DO YOU DISPLAY THAT TO THE USER? | WHAT DOES THIS QUERY MEAN: SELECT USER_NAME, USER_ISP FROM USERS LEFT JOIN ISPS USING (USER_ID)? | HOW DO YOU DISPLAY THE LIST OF DATABASE IN MYSQL? | HOW DO YOU DISPLAY THE STRUCTURE OF THE TABLE?

Mysql Interview Question and Answers:

36.     What is the difference between mysql_fetch_array and mysql_fetch_object?
      mysql_fetch_array(): - returns a result row as a associated array, regular array from database.
mysql_fetch_object: - returns a result row as object from database.

37.     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. How do you display that to the user?
      SELECT SQL_CALC_FOUND_ROWS page_title FROM web_pages LIMIT 1,10; SELECT FOUND_ROWS();

38.     What does this query mean: SELECT user_name, user_isp FROM users LEFT JOIN isps USING (user_id)?
      It’s equivalent to saying SELECT user_name, user_isp FROM users LEFT JOIN isps WHERE users.user_id=isps.user_id

39.     How do you display the list of database in mysql?
      SHOW DATABASES;

40.     How do you display the structure of the table?
      DESCRIBE table_name;

No comments:

Post a Comment