Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

2010

ORACLE Fundamental_ SQL 1‫حل أسئلة أوراكل‬

Mohamed_Suez
‫ إھداء إلى‬WWW.ARAB
/OUG/HARDWARE/TEAM2000
3/21/2010
LES 11 Managing Objects
with Data Dictionary Views

1. For a specified table, create a script that reports the column names, data types, and data types’ lengths, as
well as whether nulls are allowed. Prompt the user to enter the table name. Give appropriate aliases to the
columns DATA_PRECISION and DATA_SCALE. Save this script in a file named lab_11_01.sql.
- For example, if the user enters DEPARTMENTS, the following output results:

‫من جدول األعمده وعمل‬.... ‫ عاوزھنا اسم الحقل ونوعه ومساحته‬: ١ ‫حل السؤال‬
. ‫اإلستعالم ديناميك يدخل المستخدم اسم الجدول فتظھر النتيجة‬

select column_name,data_type,data_length,data_precision,data_scale

from user_tab_columns

where table_name = '&enter_table_name';

2. Create a script that reports the column name, constraint name, constraint type, search condition, and status
for a specified table. You must join the USER_CONSTRAINTS and USER_CONS_COLUMNS tables to obtain all of
this informa7on. Prompt the user to enter the table name. Save the script in a file named lab_11_02.sql.

- For example, if the user enters DEPARTMENTS, the following output results:
‫ عاوز تقرير يعرض اسم العمود واسم القيد ونوع القيد‬: ٢ ‫حل السؤال‬
User_constraints/user_cons_columns ‫ويجب عليك ربط الجدولين‬

.‫مع جعل التقرير ديناميك يقوم المستخدم بإدخال اسم الجدول فيطلع التقرير‬.

select
l.column_name,c.constraint_name,c.constraint_type
,c.search_condition,c.status
from user_constraints c join user_cons_columns l
on ( c.constraint_name = l.constraint_name)
where c.table_name = '&enter_table_name';
3. Add a comment to the DEPARTMENTS table. Then query the USER_TAB_COMMENTS view to verify
that the comment is present.
‫ عاوز يضيف تعليق على جدول اإلدارات ويرجع يتأكد منه‬: ٣ ‫حل السؤال‬
. ‫فجدول التعليقات‬

comment on table departments


is ' company department information including name,code and location';===============
select comments
from user_tab_comments
where table_name = 'DEPARTMENTS'

4. Find the names of all synonyms that are in your schema.

. Schema‫ اللى فال‬Synonym‫ عاوز ال‬: ٤ ‫حل السؤال‬

select *

from user_synonyms;

<. You need to determine the names and defini7ons of all of the views in your schema. Create a report
that retrieves view information: the view name and text from the USER_VIEWS data dictionary view.

. SChema‫ الموجوده فال‬Views ‫ عاوز اسماء ال‬: ٥ ‫حل السؤال‬

select view_name,text

from user_views;

6. Find the names of your sequences. Write a query in a script to display the following information
about your sequences: sequence name, maximum value, increment size, and last number. Name the script
lab_11_06.sql. Run the statement in your script.
. Sequence ‫ عاوز معلومات ھنا عن ال‬-٦
select SEQUENCE_NAME ,Max_VALUE ,INCREMENT_BY
,LAST_NUMBER

from user_sequences;
‫ﺍﳊﻤﺪ ﷲ ﺍﻟﺬﻱ ﺃﰎ ﻋﻠﻴﻨﺎ ﺇﻧﻬﺎء‬

‫ﺗﻠﻚ ﺍجملﻤﻮﻋﺔ ﺭﺍﺟﻴﲔ ﻣﻨﻪ ﺳﺒﺤﺎﻧﻪ‬

‫ﻭﺗﻌﺎﱃ ﺍﻟﺘﻮﻓﻴﻖ ﻭﺍﻟﺴﺪﺍﺩ‬

‫ﻭﺇﻛﻤﺎﻝ ﺑﺎﻗﻲ ﺍﻷﻋﻤﺎﻝ ﻋﺴﻰ ﺍﷲ‬

‫ﺃﻥ ﻳﻨﻔﻊ ﺑﻬﺎ ﺃﺧﻮﺍﻧﻨﺎ ﺍﳌﺴﻠﻤﲔ ﻓﻰ‬


‫ﻛﻞ ﻣﻜﺎﻥ ﻭﻛﻞ ﳏﺐ ﻷﻭﺭﺍﻛﻞ‬

‫ﻭﺍﻟﱪﳎﺔ‬

‫ونرجو من كل من وصل إليه‬


‫ھذا العمل أن ينشره في كل‬
‫مكان‪.‬‬

You might also like