employees jadvalidagi xodimlar sonini job_id maydoni bo’yicha guruhlab chop etuvchi so’rov yarating.
SELECT job_id, COUNT(*) AS employee_count
FROM employees
GROUP BY job_id;
Bir nechta xodim ishlovchi(bittadan ko’p) department_id ustuni ma’lumotlarini chop eting.
SELECT department_id, COUNT(*) AS employee_count
FROM employees
GROUP BY department_id
HAVING COUNT(*) > 1;
salary ustunidagi ma’lumotlarni oylik maosh deb oladigan bo’lsak yillik maoshi 100000 yuqori bo’lgan xodimlar ism, familiyasi, maoshini chop etuvchi so’rov yarating.
SELECT first_name, last_name, salary, salary * 12 AS yearly_salary
FROM employees
WHERE salary * 12 > 100000;
Ismi yoki familiyasida ketma-ket “LL” harflari mavjud xodimlar ma’lumotlarini chop etuvchi so’rov yarating.
SELECT *
FROM employees
WHERE first_name LIKE '%LL%' OR last_name LIKE '%LL%';
1997 yili ishga qabul qilingan xodimlarni maoshlarini kamayish tartibida chiqaruvchi so’rov yarating.
SELECT first_name, last_name, salary
FROM employees
WHERE YEAR(hire_date) = 1997
ORDER BY salary ASC;
IN operatoridan foydalanib Familiyalari(last_name) 'Fay', 'Baida', 'Baer' bo’lgan xodimlar ismi hamda telefon raqamini chop etuvchi so’rov yarating.