Joined: Thu Apr 05, 2007 9:57 pm Posts: 17 Has thanked: 0 time Have thanks: 0 time
DML Statements(On One Table)
1. Inserting New Rows
Code:
INSERT INTO <tablename> [<column list>] VALUES (<expression>{[,<expression>]})
Example 1:
Code:
Insert new STAFF memeber into the STAFF table with the following properties: STAFF id=1 and STAFF SALARY= 2000
You can specify values to be inserted without specifying the column names because SQL assumes that the order in which the values are entered is the same as the default sequence of the columns.
Example 2:
Code:
INSERT INTO STAFF VALUES (1,'ALI',2000,NULL); INSERT INTO STAFF VALUES (2,'EHAB',1000,NULL); INSERT INTO STAFF VALUES (3,'MARWA',3000,NULL); INSERT INTO STAFF VALUES (4,'ALI',4000,NULL);
2. Updating Values in Rows
Code:
UPDATE <tablename> SET <column name>=<expression>[,<column name>=<expression>] [WHERE <Condition>]
Example 1:
Increase the SALARY by 5 percent
Code:
UPDATE STAFF SET STAFF_SALARY=STAFF_SALARY * 1.05;