Interview Questions

How to remove duplicate entries from a table ?

Posted by om 21 April, 2010 (0) Comment

Removing Duplicate entries from Mysql database table are really simple. I have found some times interviewer ask tricky questions like this. PHP-MYSQL Beginners  just be careful !

It can all be done with three manual SQL steps! No PHP Coding required, and it works with MySQL 4 and above versions.

Step One -

CREATE TABLE MyNewTable as
SELECT * FROM MyOldTable WHERE 1 GROUP BY [column to remove duplicates by];

Step Two – You hate to keep old table with all the duplicate entries, so drop it!

DROP TABLE MyOldTable;
RENAME TABLE MyNewTable TO MyOldTable;
  • Share/Bookmark
Categories : Mysql Interview Tags :

What is diffrence between echo and print?

Posted by om 10 January, 2009 (0) Comment

Print method can return a true/false value. This may be helpful during a script execution of somesort. If you need to output data through a function, you can use print()
instead

Echo does not return a value, but has been considered as a faster executed command. echo is not a function and, as such, it does not have a return value.
echo 30;
print (30);

  • Share/Bookmark
Categories : Interview Questions Tags :

How many types of Tags are available in php?

Posted by om 10 January, 2009 (0) Comment

Standard Tags <?php
… code
?>

Short Tags <?
… code
?>

<?= $variable ?>

Script Tags <script language=“php”>
… code
</script>

ASP Tags <%
… code
%>

Short tags, script tags and ASP tags are all considered deprecated and their use is strongly discouraged.

  • Share/Bookmark
Categories : PHP Interview Tags :