Saturday, September 20, 2008

Basic Queries of SQL ...

create a table:

CREATE TABLE table_name (column1 coulmn_type( ),column2 coulmn_type( ),column3 coulmn_type( ));

insert values into table:

INSERT INTO table_name (column1,column2,column3) VALUES (value1,value2,value3);

note: VARCHAR values must be used with single quotes, like, 'haree','apple' etc.

note: if you are inserting values to all the columns then you can use:

INSERT INTO table_name (value1,value2,value3);

retreive all columns of a table:

SELECT * FROM table_name;

retreive selected columns from a table:

SELECT column1,column2,column3 FROM table_name;

to view the structure of a table:

DESCRIBE table_name; (or) DESC table_name;

No comments: