Java Reference
In-Depth Information
2. Rename a column within a table
3.
ALTER TABLE
table
[ * ] RENAME [ COLUMN ]
column
TO
newcolumn
4. Change the owner of a table
5.
ALTER TABLE
table
OWNER TO
new owner
6. Rename a table
7.
ALTER TABLE
table
RENAME TO
newtable
You can use the DROP SCHEMA or DROP VIEW command to drop a schema or view that you have
created. This is shown in the next example:
DROP SCHEMA schema_name
The
DROP
will command succeed only if the schema does not contain any objects. If the schema
contains database objects, the
DROP SCHEMA
command will return an error message.
User Privileges
Database management systems have a scheme of privileges that can be assigned to users. Privileges
are actions that can be performed on schema objects. This assignment of privileges allows granular
control of the database, allowing certain users to do certain tasks but not others tasks.
When you create a new database, you need to assign an owner for the database. By default, the owner
of the database is the user who executes the
CREATE
command. By default, only the owner and the
super user (administrator) can do anything on the database or on the object within the database.
To allow other users to work with the database, assign them the privileges to do so. Alternatively, you
can assign privileges at the group level, so that certain groups of users can or cannot do certain things
on specific database objects. This security schema is very flexible. If you have thousands of users, you
do not want to have to assign individual permissions to each of them. Thus, organizing them in groups
and assigning permissions to groups can help reduce the administrative effort.
Most database management systems support at least these three basic privileges:
Select (read)
Insert (append)
Update/delete (write)
Cert ain database management systems might support extended privilege types such as Alter, Create,
Process, Usage, and Shutdown. Refer to the documentation with the DBMS you are using for a
complete list of the privileges it supports.
Some commonly implemented privilege types include the following:
ALL (ALL PRIVILEGES)
FILE
RELOAD
ALTER
INDEX
SELECT
CREATE
INSERT
SHUTDOWN
DELETE
PROCESS
UPDATE
DROP
REFERENCES
USAGE
These privileges can be assigned to various objects in the database at the following levels:
Global
privileges apply to all databases on a given server
.