Download presentation
Presentation is loading. Please wait.
1
Authority, Sequence, Changing Data Pepper
2
SECURITY Everyone can use the same database Different people can make different changes Some to structure Some to actual data
3
Authority Levels User – s06_001 Role – employee, manager Syntax: –create role employee;
4
GRANT/REVOKE To create a session, create a table, insert, select, etc. Can restrict fields Can restrict commands Can restrict tables Ability to pass on your security to others Revoke – revokes yours and others
5
GRANT/REVOKE examples grant select, insert on customer to fred, mary, joe; grant insert on order_table to update_role; grant all on customer to fred; grant select on customer_view to mary; grant select any table to fred; grant create any table to public; Grant update(balance) on account to fred; Grant update_role to fred, mary, joe;
6
CHANGING DATA Insert – whole new row Update – change a field in a row Delete – delete a whole row Doesn’t change definition
7
INSERT fieldname, fieldname (optional) INTO Tablename or viewname VALUES (fieldvalue, fieldvalue)
8
UPDATE Tablename SET fieldname = newvalue, fieldname = newvalue WHERE condition and/or condition Ex: update students set SID = 7999, Minit = 'X' where SID = 8000;
9
Another Example || concatentates text Add “S” to the end of each student’s last name. Extend that to only add the S when the SID is less than 4000. update students set lname = (lname || 'S') where SID < 4000;
10
DELETE DELETE FROM Tablename Where condition and/or condition Example: Delete from students where sid = 8100;
11
Commit Select * from scores to see what you start with. Commit Delete all scores for sid 4444. Select * from scores to see your changes Rollback Select * from scores to see your changes go away.
12
What was important Use update and delete commands Know authority exists and is set with GRANT/REVOKE – but not syntax Know roles exist to group users – but not syntax Know commit marks a point you can roll back to.
13
Back to the Select Statement Focus: Simple use of all parts of select statement Review structure All, everything - does it mean columns or rows? Select columns / where rows Exercises in Blackboard
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.