1.

Consider the tables given below which are linked with each other and maintains referential integrity :                        Table: SAPSAPIDItemCodeItemNameItemStoragelocationS10011001ReceiverW12-B3-R24S10021002TransponderW13-B7-R87S10031003Battery BankW21-B1-R87S10041004InverterW21-B11-R2S10051005GensetW22-B15-R16                        Table: StoreStoreIDItemCodeStorelocationReceivedDate12011001Hauz Khas2016/05/2012021002Rajouri Garden2016/06/1412041003Rohini2016/05/0612051004Hauz Khaas2016/07/1512061005Rajendra Place2016/05/27With reference to the above given tables, write commands in SQL for (i) and (ii) and output for (iii) below:(0 To display the ItemCode, ItemName and ReceivedDate of all the items.(ii) To display SAPID, ItemName, ItemStoragelocation of all the items whose Receiveddate is after 2nd May 2016.(iii) SELECT sa.SAPID,ItemName, STOREID FROM SAP sa, Store st WHERE sa.ItemCode=st.ItemCode AND Storelocation = "Hauz Khas".

Answer»

(i) Select SAP.ItemCode, ItemName, ReceivedDate

From SAP sa, Store st

Where sa.ItemCode=st.ItemCode;

(ii) Select sa.SAPlD,ItemName,ItemStoragelocation

From SAP sa,Store st

Where sa.ItemCode=st.ItemCocle and Received date >" 2016 / 05 / 02";

SAPIDItem NameStore ID
S1001Receiver1201
S1004Inverter1204



Discussion

No Comment Found

Related InterviewSolutions