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

أسئلة في Subqueries


الجنرال

Recommended Posts

Q1. Create a query to display the employee numbers and last_names of all employees who earn more than the average salary. sort the results in ascending order of salary

Q2. write a query to display the employee numbers and last_names of all employees who work in a department with any employee whose last_name contains a u?

Q3. Display the last_name, department number, and job_id of all employees whose department location id is 1700 ?


Q4. Display the last_name and salary of every employee who report to King?


Q5. Display the department number, last_name, and job_id for every employee in the Executive department?

مع الشرح لو سمحتوا

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

اخي العزيز
في السؤال الول مطلوب تعمل استفسار تجيب منه ارقام المستخدمين واسمائهم لكل المستخدمين الي بياخدوا مرتب اعلي من المتوسط بالنسبه للمرتبات كلها وبعدين تصنف النتيجه تصاعدي " وهوا الديفولت بتاع اوراكل يعني انت مش حتعمله "
تتكتب ازاي وعلي فكره دي سهله خلينا نشوف
select employee_id , last_name
from employees
where salary>
(select avg(salary)
from employees
)
ي السطر الاول بتجبله رقم المستخدم واسمه
السطر التاني بتعرفه اسم الجدول الي انت عايز منه البيانات دي
اما السطر التالت وهوا الي فيه الشغل انت بتشترط الشرط الي هوا طالبه الا وهوا ان يكون مرتبه اعلي من المتوسط وفعلا بتقله salary يمون اكبر من المتوسط والداله الي بتجيب المتوسط هيا avg وهي اختصار لي average اي عدد الحاجه الي عايز تجيب ليها المتوسط علي مجموعهم وده هوا معني المتوسط
وده الي بيحصل في الصب كويري الي داخل القوسين
ده بالنسبه للسؤال الاول

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

write a query to display the employee numbers and last_names of all employees who work in a department with any employee whose last_name contains a u
السؤال ده مش واضحه معالمه مثلا ايه هوا القسم المطلوب مش مذكور اسمه وثانيا الاسم بيحتوي علي u ولا a ولا الاتنين مع بعض علشان الاجابه حتختلف ارجو منك انك توضح الحاجات دي

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

Display the last_name, department number, and job_id of all employees whose department location id is 1700
السؤال التالت
عايز الاسماء وارقام الاقسام واسم الوظيفه الي بيشتغلوها لكل لالمستخدمين بالنسبه للقسم الاي دي بتاعه 1700
select last_name,department_id,job_id
from employees
where departmet_id=1700
بس كده

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

Q4. Display the last_name and salary of every employee who report to King?
والسؤال ده يا ريت توضح معالمه اكتر السؤال بيقول او عايز الاسم والمرتب الي شهرهته كينج ولا الي بيقدم تقرير لكينج
يا ريت توضحه اكتر

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

Display the department number, last_name, and job_id for every employee in the Executive department
السؤال ده عايز ايه اسم القسم واسم الموظف والوظيفهى لكل الموظفين الي بيشتغلوا في القسم التنفيذ او department executive

select departments.department_name ,employees.last_name,employees.job_id
from employees, departments
where department_name
=
' Executive'
;
بس هنا يا مان حتستخدم الجوين حيكون اسهل من الصب كويري
مع تحياتي
...........................................

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

Q2. write a query to display the employee numbers and last_names of all employees who work in a department with any employee whose last_name contains a u?

select employe_id,last_name from employees
where department_id in (select department_id from employees
where last_name like '%u%')

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

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

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

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

×   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.

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

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

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