Describes how to perform basic actions using sql syntax
INSERT Clause
INSERT INTO `tablename`('column2', 'column1', 'column4', 'column3') VALUES ('value2', 'value1', 'value4', 'value3');
Or you can insert data into the table using the following statement. The difference being that the database must be in the same order as the columns.
INSERT INTO `tablename` VALUES ('value1', 'value2', 'value3', 'value4');
UPDATE Clause
UPDATE `tablename` SET `column2` = 'newvalue2' WHERE `column1` = 'value1';
This basically updates a row in the table and tells the DBMS to set column2 to newvalue2
where a certain condition is true. In this case
where column1 is equal to value1.
DELETE Clause
DELETE FROM `tablename` WHERE `column1` = 'value1';
This allows a user to delete a certain row in the table
where a certain condition is true. Sometimes the LIMIT statement is also used with this to prevent loss of data should the syntax be incorrect.
These are the 3 most widely used SQL Statements and should be used with caution as to not cause inconsistencies in other records. Always double check your syntax before running it
created on 14/12/2009 @ 17:07, last updated on 19/12/2009 @ 13:19
There are no comments for this tutorial yet.