Y24 Week4 A.2 Data Dictionary
Y24 Week4 A.2 Data Dictionary
2
Data Dictionary
• User-friendly views are available
– e.g. USER_TABLES
• One row for every table in your schema
3
Querying the data dictionary…contd
Prefix Scope
USER User’s view (what is in the user’s schema)
ALL Expanded user’s view (what the user can access)
DBA Database administrator’s view (what is in all users’ schemas)
“USER_TABLES”, is a view on the data dictionary
contains one row for every table owned by you (i.e. created in your schema).
DESC user_tables ^C
SELECT table_name, num_rows from user_tables;
SELECT owner, object_name, object_type FROM ALL_OBJECTS;
Select distinct owner from all_objects;
SELECT owner, table_name FROM all_tables WHERE owner=‘yma'
SQL>desc dba_tables;
SQL> select owner,table_name from dba_tables (user_tables;all_tables)
where tablespace_name =‘USERS’
5
DML – Familiarize with Data Dictionary
Find the name of the table that contains tablespace information for users;
SQL>select * from dict where table_name like 'USER_T%';
Find the names of tablespaces in the user tablespace table.
SQL> select tablespace_name from USER_TABLESPACES;
List all constraints with table name on which they are created - created by you
Oracle - SQL
• Checking the Date Format
select value from V$NLS_Parameters
where parameter=‘NLS_DATE_FORMAT’
• Setting Locality
alter session set NLS_TERRITORY=‘India’