الانتقال إلى المحتوى
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.

لماذا هذا الكود لايعطى نتيجة

Featured Replies

بتاريخ:

select employee.ename
from emp employee
where employee.empno not in
(select manager.mgr from emp manager )

على الرغم ان الكود هذا يعطى نتيجة

select employee.ename
from emp employee
where employee.empno in
(select manager.mgr from emp manager )

بتاريخ:

Because all emp_id's are not in nothing



The above SQL statement attempts to display all the employees who do not have any subordinates. Logically, this SQL statement should have returned eight rows. However, the SQL statement does not return any rows. One of the values returned by the inner query is a null value and hence the entire query returns no rows. The reason is that all conditions that compare a null value result in a null. So whenever null values are likely to be part of the resultant set of a subquery, do not use the NOT IN operator. The NOT IN operator is equivalent to !=ALL.
Notice that the null value as part of the resultant set of a subquery will not be a problem if you are using the IN operator. The IN operator is equivalent to =ANY

بتاريخ:

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

بالاضافة الى ما ذكرة الأخ / DR.Lava

يمكنك استخدام ال nvl للتعامل مع ال null value

SQL> select employee.ename
 2  from emp employee
 3  where employee.empno not in
 4  (select nvl(manager.mgr,0) from emp manager )
 5  /

ENAME
----------
SMITH
ALLEN
WARD
MARTIN
TURNER
ADAMS
JAMES
MILLER

8 rows selected.

بتاريخ:

كل الكلام السابقى كلام سليم 100%
ولكن الافضل والاصح واللى اوراكل نفسه بستعمله فى الابكليشن بتاعها
هو استخدام exist or no exist
وذلك فى الحقول التى يمكن ان تحتفظ بقيمة NULL
بمعنى الكود يكون

select employee.ename 
from emp employee 
where exist (selectmanager.mgr from emp manager  where emp_no =selectmanager.mgr ) 

بتاريخ:
  • كاتب الموضوع

dr.lava, amgad ,صدقة جارية
شكرا جزيلا على ردودكم الاكثر من رائعة وبجد دة مش جديد على المنتدى الرائع بتاعنا

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

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

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

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

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

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.