More Related Content
More from welcometofacebook
More from welcometofacebook (20)
Source codes for alerts lovs and reports generation(database)
- 2. Illustration 1: Show Top 5 highpaid staff
SELECT * FROM (
SELECT staff_no, last_name,first_name, salary, ROWNUM rn
FROM (SELECT staff_no,last_name, first_name, salary FROM staff ORDER BY salary DESC))
WHERE RN<=5;
OR
SELECT staff_no, last_name, first_name, salary, ROWNUM rn
FROM (SELECT staff_no, last_name, first_name, salary FROM
staff ORDER BY salary DESC)
WHERE ROWNUM<=5
Illustration 2: Show and count the number of staff by Birthday Month
SELECT staff_no, Last_name,first_name, to_char(dob,'DDMMYYYY'), to_char(dob,'MM')
FROM staff
ORDER BY to_char(dob,'MM')
Illustration 3: Display the staff who are younger than the date specified
SELECT staff_no, last_name,first_name, to_char(dob,'DDMMYYYY')
FROM staff
WHERE dob > To_Date(:DATE_TO_QUERY,'DDMMYYYY')