SQL Basic

 1.Merit Rewards


SELECT ei.employee_ID, ei.name

FROM employee_information ei

JOIN last_quarter_bonus b ON b.employee_ID = ei.employee_ID

WHERE ei.division LIKE 'HR'

AND b.bonus >= 5000;


2.Student Analysis

SELECT a.roll_number,a.name

FROM student_information a

INNER JOIN examination_marks b

ON a.roll_number = b.roll_number

GROUP BY b.roll_number

HAVING SUM(b.subject_one + b.subject_two + b.subject_three) < 100;


3.Country Codes

SELECT a.customer_id,a.name,concat("+",b.country_code,a.phone_number)

FROM customers as a

LEFT join country_codes as b 

ON a.country=b.country

ORDER BY a.customer_id;


4.Profitable Stocks

SELECT a.customer_id,a.name,concat("+",b.country_code,a.phone_number)

FROM customers as a

LEFT join country_codes as b 

ON a.country=b.country

ORDER BY a.customer_id;


5.Student Advisor

SELECT roll_number,name

FROM student_information a

INNER JOIN faculty_information b

ON a.advisor = b.employee_ID

WHERE (b.gender = 'M' and b.salary>15000) or (b.gender = 'F' and b.salary>20000);

Post a Comment

0 Comments