Sunday, 16 December 2012

Episode 2 : Database Manipulation Commands




Use the following commands to create and make changes to your database and tables.

Command (Blue color) and What It Does

CREATE databasename Creates the database.
CREATE tablename (field1, field2,.field3, and so on PRIMARY KEY(field)) Creates a new table
ALTER TABLE tablename WHERE condition  Modifies a table in the database.
RENAME TABLE oldtablename  TO Renames a table in the database. newtablename
INSERT INTO tablename (field1, field2, . . .) VALUES (“value1”,“value2” . . .) Inserts information into the table.
UPDATE tablename SET field1=value1, field2=value2 . . . WHERE condition the table. Changes information already stored in
DELETE FROM tablename WHERE condition Deletes a record from the specified
table.
DROP tablename Deletes the table.
DROP database Deletes the database.
LOAD DATA INFILE “filename” INTO TABLE tablename. Loads a large quantity of data into the database


Written by ‘Shojib’.

No comments:

Post a Comment