Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Wednesday, April 7, 2010

mysql db name and table name limits

Database, table, and column names should not contain more the 64 characters
Database, table, and column names should not end with space characters.
Database, table, and column names should not contain slashes "\" ,"/" dots "." and commas ","

Identifier Maximum Length (characters) Database 64 Table 64 Column 64 Index 64 Constraint 64 Stored Function or Procedure 64 Trigger 64 View 64 Alias 256 (see exception following table) Compound Statement Label 16


Ref:
http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
http://www.allinterview.com/showanswers/20054.html

Tuesday, April 6, 2010

Temporary tables in mysql

Question: What is temporary table and how to create temporary table in mysql

Answer:

Mysql Temporary tables are special kind tables it will be deleted when the script finishes its execution

To create temporary table use the command

CREATE TEMPORARY TABLE table_name (select mail_id,answer from interview_question)

If you want to delete the temporary table means

DROP TEMPORARY TABLE IF EXISTS table_name

How to create table same as another table?

Question: How to create table same as another table?(same structure)

Answer:Consider you are having a table named mysql_interview .

To make a same structured table use the following statment

$> CREATE TABLE your_new_tablename like mysql_interview

Monday, April 5, 2010

How to save query output as a table

Answer:

We need to use insert command followed by the select query

See the command

INSERT INTO mysql_interview SELECT * FROM source_table

what is name of mysql configuration file?

Answer

The configurations are stored in the my.cnf file