Lab2 - DML1
Lab2 - DML1
2- if you are adding all values to all columns, you don’t need to spcify column names
Example 1:
❖ Insert new student into the student table with the following properties:
Student id=1 , Name= Ali, Age=19, and City= ‘Cairo’
1
2. Updating Values in Rows
UPDATE <tablename>
SET <column name>=<expression>,<column name>=<expression>
[WHERE <Condition>]
Example 1:
update Student
set age=age+1
update Student
set name='ahmed'
where SSN=1
❖ Change the name of the STAFF with id 1 back to ‘ALI’ and let his age be 18
update Student
set name='Ali',
age=18
where SSN=1
DELETE
FROM <table name>
[WHERE <Condition>]
Example 1:
2
Example 2:
BETTER STATEMENT THAT DOES THE SAME JOB OF THE PREVIOUS ONE :