We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
ngoccth_SQL SERVER:
WITH table_1 AS (
SELECT fr.ID, friend_id, name, salary AS salary_id
FROM Friends AS fr
JOIN Students AS st ON fr.id = st.id
JOIN Packages AS pa ON pa.id = fr.id
)
SELECT name
FROM table_1
JOIN Packages AS pa ON pa.id = table_1.friend_id
WHERE salary_id < pa.salary
ORDER BY pa.salary
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Placements
You are viewing a single comment's thread. Return to all comments →
ngoccth_SQL SERVER: WITH table_1 AS ( SELECT fr.ID, friend_id, name, salary AS salary_id FROM Friends AS fr JOIN Students AS st ON fr.id = st.id JOIN Packages AS pa ON pa.id = fr.id ) SELECT name FROM table_1 JOIN Packages AS pa ON pa.id = table_1.friend_id WHERE salary_id < pa.salary ORDER BY pa.salary