Database Reference
In-Depth Information
2. Delete one specific row from the EMPLOYEE table.
DELETE FROM EMPLOYEE
WHERE EmployeeNo = 3344
3. Delete from EMPLOYEE table those rows for staff earning less than 25000.
DELETE FROM EMPLOYEE
WHERE EmployeeCode = 'STF' and Salary <25000
Data Control in SQL
A relational database management system controls access to the database based on
three concepts: user identifier, data ownership, and access privileges. The database
administrator assigns a user identifier and password to each authorized user for
signing onto the database system. A user with a proper user identifier performs
every action on the database. Access privileges indicate which database objects a
user may access and what actions he or she may perform. Chapter 16 explores this
topic of database security in greater detail.
In a relational database, every object has an owner. The user identifier indicates
the owner as defined in the AUTHORIZATION clause during schema definitions.
Initially, only the owner has all access privileges to the database objects. When an
authorized user creates a table using the CREATE TABLE statement, the user
automatically becomes the owner of the table, receiving all access privileges to that
table. Later, the owner may give access privileges to other authorized users.
SQL provides two commands for controlling access to the relational database.
The database administrator has these commands to give access privileges to indi-
viduals or groups of users and to take away the privileges as soon as the privileges
are to be removed. Access privileges permit users to perform various actions on
tables or views. The privileges include:
SELECT
Permission only to retrieve data from a table or view
INSERT
Permission to add new rows into a table
UPDATE
Permission to modify the contents of a table
DELETE
Permission to remove rows from a table
REFERENCES
Permission to reference columns of a named table in integrity
constraints
INSERT, UPDATE, and REFERENCES may be restricted to specific columns
in the applicable table.
Providing Access Privileges
SQL Command
GRANT
Function
Give access privileges on database objects to specific users.
Search WWH ::




Custom Search