You are on page 1of 3

1.

You need to list out all Purchase Requisitions that do not have an
associated Purchase order.

select
prh.segment1 "PR NUM",
trunc(prh.creation_date) "CREATED ON",
trunc(prl.creation_date) "Line Creation Date" ,
prl.line_num "Seq #",
msi.segment1 "Item Num",
prl.item_description "Description",
prl.quantity "Qty",
trunc(prl.need_by_date) "Required By",
ppf1.full_name "REQUESTOR",
ppf2.agent_name "BUYER"

2. You need to list out all cancel Requisitions

3. Identifying all PO's which does not have any PR's


---list all Purchase Requisition without a Purchase Order that means
a
PR has not been autocreated to PO.

SELECT prh.segment1 "PR NUM", TRUNC (prh.creation_date) "CREATED ON",


TRUNC (prl.creation_date) "Line Creation Date", prl.line_num
"Seq #",
msi.segment1 "Item Num", prl.item_description "Description",
prl.quantity "Qty", TRUNC (prl.need_by_date) "Required By",
ppf1.full_name "REQUESTOR", ppf2.agent_name "BUYER"

7. List all the PO's with there approval ,invoice and Payment Details
----- List and PO With there approval , invoice and payment details

SELECT a.org_id "ORG ID", e.segment1 "VENDOR NUM",


e.vendor_name "SUPPLIER NAME",
UPPER (e.vendor_type_lookup_code) "VENDOR TYPE",
f.vendor_site_code "VENDOR SITE CODE", f.address_line1 "ADDRESS",
f.city "CITY", f.country "COUNTRY",
TO_CHAR (TRUNC (d.creation_date)) "PO Date", d.segment1 "PO NUM",
d.type_lookup_code "PO Type", c.quantity_ordered "QTY ORDERED",
c.quantity_cancelled "QTY CANCELLED", g.item_id "ITEM ID",
g.item_description "ITEM DESCRIPTION", g.unit_price "UNIT PRICE",
(NVL (c.quantity_ordered, 0) - NVL (c.quantity_cancelled, 0)
)

* NVL (g.unit_price, 0) "PO Line Amount",


(SELECT DECODE (ph.approved_flag, 'Y', 'Approved')
FROM po.po_headers_all ph
WHERE ph.po_header_id = d.po_header_id) "PO Approved?",
a.invoice_type_lookup_code "INVOICE TYPE",
a.invoice_amount "INVOICE AMOUNT",
TO_CHAR (TRUNC (a.invoice_date)) "INVOICE DATE",
a.invoice_num "INVOICE NUMBER",
(SELECT DECODE (x.match_status_flag,
'A', 'Approved'
)
FROM ap.ap_invoice_distributions_all x
WHERE x.invoice_distribution_id = b.invoice_distribution_id)
"Invoice
Approved?",
a.amount_paid, h.amount, h.check_id, h.invoice_payment_id
"Payment Id",
i.check_number "Cheque Number",
TO_CHAR (TRUNC (i.check_date)) "PAYMENT DATE"

PO to GL query

SELECT prh.segment1 req_number,


prd.distribution_id,
poh.segment1 po_num,
poh.org_id,
rsh.receipt_num,
api.invoice_num,
apl.line_number,
aps.vendor_name

Query to fetch Supplier Information

SELECT asp.vendor_name supplier_name,


asp.segment1 supplier_number,
ass.vendor_site_code supplier_site,
hou.name operating_unit,
decode(ass.pay_on_code,'RECEIPT',ass.pay_on_code,'')
pay_on_receipt_flag,
ass.pay_on_receipt_summary_code invoice_summary_level,
ieppm.payment_method_code

SQL QUESTIONS

1. List all the employees who have at least one person reporting to them.
2. List the employee details if and only if more than 10 employees are
present in department no 10.
3. List the name of the employees with their immediate higher authority.
4. List all the employees who do not manage any one.
5. List the employee details whose salary is greater than the lowest salary of
an employee belonging to deptno 20.
6. List the details of the employee earning more than the highest paid
manager.
7. List the highest salary paid for each job.
8. Find the most recently hired employee in each department.
9. In which year did most people join the company? Display the year and the
number of employees.
10. Which department has the highest annual remuneration bill?
11. Write a query to display a * against the row of the most recently hired
employee.
12. Write a correlated subquery
to list out the employees who earn more than the average salary of their
department.
13. Find the nth maximum salary.
14. Select the duplicate records (Records, which are inserted, that already
exist) in the EMP table.
15. Write a query to list the length of service of the employees (of the form n
years and m months).

You might also like