Lab 2
Lab 2
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’
///////////////////////////////////////////////////////////////////////////////////
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
Eng-Abdallah Hamed lab-2 Database
Example 3: (Update more than one cloumn with a condition)
❖ 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:
Example 2:
BETTER STATEMENT THAT DOES THE SAME JOB OF THE PREVIOUS ONE :