You are on page 1of 2

SQL Test(MSSQL/Oracle)

LOTNO STEPID IN_QTY IN_DATE OUT_QTY OUT_DATE


702ZZAB A060 800 20170114 120952000 800 20170115 085817000
702ZZAB A265 2330 20170120 080406000 2327 20170121 230450000
702ZZAC A060 8589 20170113 122857000 8589 20170114 125903000
702ZZAC A085 8589 20170117 061307000 8544 20170117 071845000
702ZZAC A115 8544 20170117 234259000 8544 20170118 005053000
702ZZAC A265 8544 20170120 153705000 8529 20170121 112631000
Table Name: T_TRAN

1. Write a Query, to get Last StepID, and Last Qty from table above.
Note : Try to get last record(sort by out date)
Statement Input: LOTNO = ‘702ZZAB’

Expected Output:
LOTNO LASTSTEP LASTQTY LASTTRANSACTION
702ZZAB A265 2327 20170121 230450000
2. Get Yield information from T_TRAN, display only those step with yield lose (2 decimal).
Note: Yield = (OUT Qty/ IN Qty) * 100
Statement Input: LOTNO = ‘702ZZAC’

Expected Output: LOTNO STEPID YIELD


702ZZAC A085 99.48
702ZZAC A265 99.82

3. Get Total Out Qty At StepID : A265 from T_TRAN.

Expected Output: TOTAL_QTY


10856

4. Get LotNo that with PMC process, by link T_PROCESS table with T_TRAN table.

STEPID DESCRIPTION
A060 DIEATTACH
A085 WIREBOND
A115 PMC
A120 MOLD
A265 FYI
Table Name : T_PROCESS

Expected Output: LOTNO


702ZZAC
5. Use other method, to return same result based on query given.
SELECT LOTNO
FROM T_TRAN
GROUP BY LOTNO

Output :
LOTNO
702ZZAB
702ZZAC

6. Write 1 simple query base on T_TRAN table, to return LotNo with more than 2 records.

Output :
LOTNO
702ZZAC
7. Write a simple stored procedure, by passing in 2 parameter and return 1 result with Sum all
number in between.
e.g. Parameter 1 = 10, Parameter 2 = 15, Result = 50 (11+12+13+14)

Programming Test (VB/C#)


8. How do you find second highest number in an integer array?

9. In an array 1-100 numbers are stored, one number is missing how do you find it?

10. How to perform generic error handling routine?

You might also like