الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

مالفرق بين الـ Constraint على مستوى جدول ومستوى عمود وايهما افضل؟؟

Featured Replies

بتاريخ:

السلام عليكم جميعا اعضاء ومشرفي المنتدى ورحمة الله وبركاته
سؤالي عن الـ Constraint
مالفرق بين الـ Constraint على مستوى جدول ومستوى عمود وايهما افضل؟؟
ارجو المساعده العاجلة
اختكم

بتاريخ:



Column Level Constraints refers Only One Column .Which does
not have the column name at declaration time .
Ex :
 Create table emp
     ( empno number primary Key,
      --,
      --);



Table Level constraints refers one or more than one column .
Which does have column name at declaration time.
Ex:

Create table emp
     ( empno number ,
      --,
      --,
      Constraints pk_con primary Key(empno));



All constraints can be created as Column and Table level
(like, primary key, foreign key,unique)

Not Null constraints can only be created as column level
constraints .

so A column constraint is specified as part of a column definition and applies only to that column.

A table constraint is declared independently from a column definition and can apply to more than one column in a table

Ex:

CREATE TABLE CLASS (
ROOM NUMBER(10) , 
SUBJECT VARCHAR2(200),
CODE VARCHAR2(50) NOT NULL,  /*  Column level constraint*/
ID NUMBER(8,2),
CLASS_DATE DATE, 
CONSTRAINT PK_1 PRIMARY KEY (ROOM));  /*   table level

بتاريخ:

وعليكم السلام و رحمة الله

(طبعا انا جديد في المنتدى) ,,, لكن ان شاء الله اقدر افيد


حسب دراستي السابقة للـ SQL انه لايوجد فرق بين الاثنين الفرق فقط في الساينتكس syntax
والفرق في الساينتكس : انه في الـ column level ندخل الـ constraint بعد الكولمن مباشرة ,,,, اما في table level ندخل الـ constraint بعد ادخال جميع الكولمنز .
وهذا مثال (بالنسبة لل check)

هذا للـ column level

create table employee(eno number(3),ename varchar2(20),esal number constraint
esal_chk check(esal<=5000),esex char(1) constraint esex_chk check(esex='f' or esex='m'))


وهنا للـ table level

create table employee(eno number not null,
ename varchar2(20),
esal number,
esex number,
dname varchar2(20),
design varchar2(20),
company varchar2(20),
constraint esal_chk check(esal>0 and esal<10000),
constraint esex_chk check(esex ='f' or esex ='m'))



أما بالنسبة لأيهما أفضل ,,, فالله أعلم ,,, لأنني مجرد طالب
والعذر اذا كان هناك اي خطأ فأنا مبتدئ

بتاريخ:

الـ Constraint على مستوى جدول يمكن حذفة
الـ Constraint على مستوى الحقل لايمكن حذفة
الافضل الـ Constraint على مستوى جدول وشكراً

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.