Home PHP Ajax Regex Interviews Contact us    

PHP


Interview Questions



.Net | PHP | Mysql | Java script

Mysql interview questions
  1. In MySQL, how do I create a database?

    CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name [create_specification [create_specification] ...]

  2. In MySQL, how do I create a table?

    CREATE TABLE [IF NOT EXISTS] tbl_name [(create_definition,...)] [table_options] [select_statement]

  3. What’s the default port for MySQL Server?

    3306

  4. Explain the difference between FLOAT, DOUBLE and REAL?

    FLOATs store floating point numbers with 8 place accuracy and take up 4 bytes. DOUBLEs store floating point numbers with 16 place accuracy and take up 8 bytes. REAL is a synonym of FLOAT for now.

  5. How would you change a column from VARCHAR(20) to VARCHAR(30)?

    ALTER TABLE tablename CHANGE fieldname fieldname VARCHAR(30).

  6. How would you delete a column?

    ALTER TABLE tablename DROP fieldname.

  7. What do % and _ mean inside LIKE statement?

    % corresponds to 0 or more characters, _ is exactly one character.

  8. How do you concatenate strings in MySQL?

    CONCAT (string1, string2, string3)

  9. What are mysql db engines?

    MyISAM, Heap, Merge, INNO DB, ISAM

  10. What is the difference between truncate and drop?

    Truncate will empty the data of table

    Drop will delete the data and structure of table

  11. What is the difference between group by and order by?

    Group by controls the presentation of the rows, order by controls the presentation of the columns for the results of the SELECT statement.

  12. What is a view? Why use it?

    view is a virtual table made up of data from base tables and other views, but not stored separately.

  13. What is the basic difference between a join and a union?

    A join selects columns from 2 or more tables. A union selects rows.

  14. What is the syntax of creating INDEX in Mysql?

    CREATE [UNIQUE|FULLTEXT|SPATIAL] INDEX index_name [index_type] ON tbl_name (index_col_name,...)

  15. How can you see all indexes defined for a table?

    SHOW INDEX FROM tabllename;

  16. How will get the information about the columns in a table

    DESCRIBE tbl_name

    or

    DESC tbl_name

  17. Explain advantages of InnoDB over MyISAM?

    Row-level locking, transactions, foreign key constraints and crash recovery.

  18. Explain advantages of MyISAM over InnoDB

    Much more conservative approach to disk space management - each MyISAM table is stored in a separate file, which could be compressed then with myisamchk if needed. With InnoDB the tables are stored in tablespace, and not much further optimization is possible. All data except for TEXT and BLOB can occupy 8,000 bytes at most. No full text indexing is available for InnoDB. TRhe COUNT(*)s execute slower than in MyISAM due to tablespace complexity.

  19. Use mysqldump to create a copy of the database?

    mysqldump -h mysqlhost -u username -p mydatabasename > dbdump.sql

  20. If the value in the column is repeatable, how do you find out the unique values?

    Use DISTINCT in the query

    Eg:- SELECT DISTINCT name FROM members



Feed Back of this Topic
 
Name :
Email :
Topic :
Comments :

Ajax


Regular Expression


 
Copyright © 2007 123developers.com
Contact us | Disclaimer