الانتقال إلى المحتوى

تابع الاخطاء الخفية التي يقع فيها المبرمجون


سالم ناصر

Recommended Posts

2 - احذر من الوقوع في فخ not in حيث ان هذا العبارة تعطي القيمة false اذا كانت اي قيمة في ال subquery هي null



    SQL> select  count(*)
      2  from    outgoing_bucket
      3  where   notification_id not in
      4  (select notification_id
      5   from   incoming_bucket);

    COUNT(*)
    --------
           0


    SQL> select  count(*)
      2  from    outgoing_bucket
      3  where   notification_id is not null
      4  and     notification_id not in
      5  (select notification_id
      6   from   incoming_bucket
      7   where  notification_id is not null);

    COUNT(*)
    --------
       19056


رابط هذا التعليق
شارك

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

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

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

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   تمت استعادة المحتوى السابق الخاص بك.   مسح المحرر

×   You cannot paste images directly. Upload or insert images from URL.

جاري التحميل
×
×
  • أضف...

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

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