Exercise 1 Write pseudocode for an embedded SQL program that ...

77 downloads 219 Views 164KB Size Report
Write pseudocode for an embedded SQL program that gets the id of an author from a user and then looks up and ... DECLARE cursor CURSOR FOR query;.
Exercise 1 Write pseudocode for an embedded SQL program that gets the id of an author from a user and then looks up and prints all books written by that author. Assume that the code to connect/disconnect to the database has already been written and you do not need to handle errors. Use this subset of the library DB action(transactionid,borrowdate,duedate,returndate,winner,late) book_description(bookdescid,title,authorid) Cursor Syntax DECLARE cursor CURSOR FOR query; FETCH {NEXT|PRIOR|FIRST|LAST} FROM cursor; UPDATE table SET … WHERE CURRENT OF cursor; DELETE FROM table WHERE CURRENT OF cursor; Possible Pseudocode Syntax result