Real time Problems/Challenges
Feel proud in calling yourself as a computer/IT engineer 😒 ? Simple, in this thread - a sort of challenge will be thrown for all such engineers. The challenge will be based on live situations that software engineers face in their everyday life and solutions of such problems is not mentioned or taught directly in any engineering books. But if you use your little bit of brains and concepts taught in engineering or in any training, they can be solved. So any one calling him/her as a CS/IT engineer would like to solve simple problems I am going to throw in this thread ?
Problem : You have following two tables and you are supposed to write a simplest SQL query that would give me data as shown in Table 3
Table 1 : REF_ASSET_LIABILITY with structure as following:
ASSET_LIABILITY_ID - Primary key -NUMBER(10,0)
ASEET_LIABILITY_NAME - VARCHAR2(20)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm4.static.flickr.com%2F3513%2F3973903815_d26e475f67.jpg&hash=5b969c2cc14dd7f3e746ee5702f97f15)
Table 2 : PORTFOLIO_HOLDING with structure as following:
ID - Primary key -NUMBER(10,0)
PORTFOLIO_ID - NUMBER(10,0)
PORTFOLIO_NAME - VARCHAR2(20)
CUSTOMER_ID - VARCHAR2(10) -FOREIGN KEY[SOME OTHER TABLE]
BUY_COST -NUMBER(23,5)
MARKET_VALUE -NUMBER(23,5)
ASSET_LIABILITY_ID - NUMBER(10,0) -FOREIGN KEY[REF_ASSET_LIABILITY]
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2605%2F3977315466_90cdd0dc8b.jpg&hash=dc5352c9ff8fc2792865c895832397b3)
Now I just need to get the data from these tables in the following form
Table 3: Outcome
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2600%2F3973896831_eae4a862a7.jpg&hash=c113fe31d8b9f65fcd16554ab43ea033)
PS: Everyone is free to throw REAL TIME challenges/problems in this thread.
Note: Not direct questions should be included that can be EASILY find in any books. 😀
[EDIT]
Also in above problem a check should be made where CUSTOMER_ID=C1. Though it is not necessary but it would be better if you people include it also in the query.
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2519%2F4063656539_2bfd9b2a99.jpg&hash=9eb71dd5347e3fa0d02573fee6fc084f)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2438%2F4063657045_c5cfb5a715.jpg&hash=cfe7f1ddf0c505d2d72b45403702e3a3)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2653%2F4064404940_5fbd826343.jpg&hash=6657ab793116c4bd10ccf39466c85283)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2705%2F4063657259_d7ab8d8900.jpg&hash=cb090f6c9595d7ce4301059ccfabfc4d)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm4.static.flickr.com%2F3495%2F4063657411_daf7290f2e.jpg&hash=89f57fd45359dbf86a9a19c6fb79d7c3)
![[IMG]](proxy.php?image=http%3A%2F%2Ffarm3.static.flickr.com%2F2629%2F4063693019_52c6dfbb4a.jpg&hash=6eecd09e5bf397a8404161447d13288e)