SCII Interview Question

Basic database related and some technical logic