- A SO0001 SO0002 SO0003
- B SO0002 SO0003 SO0003
- C SO0003 SO0002 SO0003
- D SO0002 SO0002 SO0003
- Share this MCQ
Answer:
C
Share this MCQ
Justification:
- a) The code performs a join between the two tables on SalesID, which means only related records, or records that exists in both locations for that field will be returned. Therefore, we will not see SO0001 in the output.
- b) The three sales order IDs are correct, but they are in the wrong order because the order of the selects is based on the record ID on the sales line descending - resulting in SO0003 (highest recID on the lines), then SO0002, then finally SO0003 again (lowest recID on the lines).
- c) The code performs a join between the two tables on SalesID, which means only related records, or records that exists in both locations for that field will be returned. Therefore, we will not see SO0001 in the output. We then specify to order the salesLine table in descending order based on the RecID field. The while loop will print the SalesID line by line in that order, which would yield the result: SO0003 SO0002 SO0003.
- d) The code performs a join between the two tables on SalesID, which means only related records, or records that exists in both locations for that field will be returned. There is only one sales line with SalesID SO0002.
Related Lesson: Data Retrieval
Click me to Read more Question & Answer of Module 14: Database ManipulationShare this MCQ