Question Authors' Forum

SQL DELETE and INSERT: Validating outputs

SQL DELETE and INSERT: Validating outputs

by jairo souza -
Number of replies: 2

Hi, I'm using coderunner SQL-type questions in my college and it's great. But I'm can't figure out how to create questions to teach DELETE and INSERT. I think I need to run a SELECT after the student's answer, but the extra template data field runs before it.

Do you have suggestions or examples?

Thanks a lot!

In reply to jairo souza

Re: SQL DELETE and INSERT: Validating outputs

by Richard Lobb -

The SQL program you run consists of the Extra field followed by the Student answer followed by the Test code. So you simply put the SELECT query you want to run in the Test field (usually after an explanatory SQL comment).

But you can of course customise the prototype to reorder the three fields and also to incorporate the Global extra field if you like.

In reply to Richard Lobb

Re: SQL DELETE and INSERT: Validating outputs

by jairo souza -

Got it! I didn't notice the test field could be filled with code. I thought it was just to describe the test cases. It works. Thank you very much, Richard!