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

ما هى فائدة where فى الجملة التالية؟

Featured Replies

بتاريخ:

insert into (select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50   )

values ( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
       'ST_CLERK' , 5000 , 50);


السادة الكرام .. هل منكم من يدلنى على فائدة جملة where فى الجملة السابقة .. أنا شايف ان ملهاش لازمة !!!؟؟؟
على فكرة المثال موجود فى introduction to oracle9i: SQL 8-23
:unsure:

بتاريخ:

as u said
this condition is not meanfull in this case,
but i think they make it 2 mention u that u can use this condition WITH CHECK OPTION in the next example may B
:unsure:

anyway, "introduction to oracle9i: SQL" had some little mistakes:
Ckeck NVL2 convert function description syntax P(3-48) u'll find another mistake
empr3 is the value returned if expr2 is null
so it had 2B expr1 instead of expr2

another one
Check P(6-15), last line

ALL means less than the maximum. >ALL means grator than the minimum>
Correct it to
ALL means less than the minimum. >ALL means grator than the maximum>

ALSO ANOTHER BAAAD ONE @ Page No 4-31
Joins - Comparing SQL: 1999 to Oracle Syntax

Non-Equi-Join ---> Join Using
so it had 2B Join ON instead of Join USING

بتاريخ:

The first statement will insert all those record whose deparment id = 50


Second statement will create one record only
removing where clause from select statement will insert all record

بتاريخ:

ولكن - على حد علمي - أن أي عملية لإدخال لسجل باستخدام VALUES cluse:

INSERT INTO ([i]table | view | subquery[/i])
VALUES ([i]expr | constant[/i] )



فإنه يدخل سجل واحد فقط.

فالمثال الموضح أعلاه

insert into (select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50 )

values ( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
'ST_CLERK' , 5000 , 50);



يطابق تماماً
INSERT INTO employees (employee_id, last_name, email, hire_date, job_id, salary, department_id)

VALUES( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
'ST_CLERK' , 5000 , 50);



ولكن إذا كان المراد إدخال أكثر من سجل في آن واحد، يمكن إستخدام ال subquery بدون VALUES كالآتي:

INSERT INTO ( table | view | subquery ) SUBQUERY

والله أعلم،،،

  • بعد 3 أسابيع...
بتاريخ:

أخي الفاضل

insert into (select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50 )

values ( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
'ST_CLERK' , 5000 , 50);



المثال هنا غير واضح نوعا ما واستخدامه في غير هذا الموضع أفضل ..
لكن المقصود هنا أن ال where clause هنا سوف يجبر اليوزر على ادخال البيانات التي تحقق هذا الشرط

بمعنى أنه لو أن اليوزر حاول أن يضع رقم 80 بدلا من 50 فلن يتم ادخاله الى قاعدة البيانات

والله أعلم ..

أسأل الله لنا ولكم العلم النافع والعمل الصالح

أخوكم // اوراكل نجد

تم تعديل بواسطة Oracle^Man

بتاريخ:

Where ليس لها أي اهمية في المثال المذكور ولن تؤثر على النتيجة

بتاريخ:

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

this condition is not meanfull in this case,
but i think they make it 2 mention u that u can use this condition WITH CHECK OPTION


:bro. Oracle^Man
لكن المقصود هنا أن ال where clause هنا سوف يجبر اليوزر على ادخال البيانات التي تحقق هذا الشرط

بمعنى أنه لو أن اليوزر حاول أن يضع رقم 80 بدلا من 50 فلن يتم ادخاله الى قاعدة البيانات

your mention was right ONLY if u use WITH CHECK OPTION Clause
insert into (select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50 WITH CHECK OPTION)

values ( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
'ST_CLERK' , 5000 , 50);

تم تعديل بواسطة عروة

بتاريخ:

السلام عليكم ورحمة الله وبركاته
أعتقد أن

select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50


ما هو إلا view ولكن بدلا من كتابة اسم الـview تم كتابة الجملة كاملة
وبالتالى فإنه لا يمكن عمل insert لـrow لن تراه ال view

أى أن الجملة المفروض كالتالى

create view test 
as select employee_id, last_name, email, hire_date, job_id, salary, department_id
from employees where department_id = 50 ;



ثم بعد ذلك

insert into test values ( 99999, 'Taylor', 'Dtaylor' , to_date('07-jun-99','dd-mon-rr'),
'ST_CLERK' , 5000 , 50);


أرجو من الله أن أكون فاهم صح
نفعنا الله وإياكم بالعلم النافع

أدرى بأن هناك فجرا .. وأن بعد العسر يسرا
لكنهم ساموا الفتى وبلاده عسفا وقهرا
والعالم الحيران يشهد ما يحل بأمتى
وأنا هنا .. فى غربتى .. فى لوعتى
أبكى وأمسح فى ذهول دمعتى
وأظل أنظر للسماء .. والقلب يخفق بالدعاء
يارب .. أوقظ أمتى

بتاريخ:

أخي h_elshawaf
وعليكم السلام ورحمة الله وبركاته،،
كل عمليات اللإدخال العادية تستخدم الصيغة التالية:
( INSERT INTO ( table | view | subquery

بعد ذلك إذا كنت عاوز تدخل سجل واحد فقط محدد بقيم معينة في هذه الحالة تستخدم VALUE Clause
.......INSERT INTO ( table | view | subquery VALUES

ولكن إذا كان المراد إدخال أكثر من سجل في آن واحد، يمكن إستخدام ال subquery بدلا من VALUES كالآتي:

INSERT INTO ( table | view | subquery ) SUBQUERY

والمثال الموضح أعلاه: موجود فى introduction to oracle9i: SQL 8-23
يستتخدم الصيغة التالية:
INSERT INTO subquery VALUES
وليست
INSERT INTO view VALUES

إذا فإن عملية الإدخال الموضحة أعلاه صحيحة 100% - بغض النظر عن وجود الـWHERE Clause

أرجو أكون أفدتكم :D

تم تعديل بواسطة عروة

  • بعد 1 شهر...
بتاريخ:

where condition ليس له أي تأثير في جملة الــ insert المكتوبة :)

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

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

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

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

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

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.