Professional Documents
Culture Documents
ORACLE Fundamental - SQL 1 لكاروأ ةلئسأ لح: Mohamed - Suez
ORACLE Fundamental - SQL 1 لكاروأ ةلئسأ لح: Mohamed - Suez
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
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.
عاوز يضيف تعليق على جدول اإلدارات ويرجع يتأكد منه: ٣ حل السؤال
. فجدول التعليقات
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.
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;
ﺍﳊﻤﺪ ﷲ ﺍﻟﺬﻱ ﺃﰎ ﻋﻠﻴﻨﺎ ﺇﻧﻬﺎء
ﻭﺍﻟﱪﳎﺔ