Oracle Data Dictionary (Cont.)
Some Useful Commands
- To display the names of objects created by users:
SQL> SELECT object_name FROM user_objects;
ALL_TAB_COLUMNS
contains information about columns of all tables and views.
Table name such as inventory
has to use capital letters.
Oracle is a case-insensitive system, but is with few exceptions.
SQL> SELECT column_name, data_type FROM all_tab_columns
2 WHERE table_name = 'INVENTORY';
TABLE_PRIVILEGES
and COLUMN_PRIVILEGES
list privileges granted:
SQL> SELECT grantor, delete_priv FROM table_privileges
2 WHERE table_name = 'USER_TABLES';
USER_VIEWS
contains information about views:
SQL> SELECT view_name FROM user_views;
USER_TYPES
provides a top-level view of each object type:
SQL> SELECT type_name FROM user_types;
USER_DEPENDENCIES
contains information about dependencies:
SQL> SELECT referenced_name FROM user_dependencies
2 WHERE name = 'INVENTORY';
Schemata
A schema
is a collection of tables, indexes, and other related database objects.
The full name of a table is schemaname.tablename
, e.g., the following two commands are the same for the user/schema wenchen
:
SQL> SELECT title FROM inventory;
SQL> SELECT title FROM wenchen.inventory;