SQL Database Creation · Module 6

Control-of-Flow Statements - Exercise

Self-study assessment

Control-of-Flow Statements - Exercise

Control-of-flow statements
Objective: Practice writing a control-of-flow statement. Exercise scoring
This exercise is worth a total of 5 points. For self-assessment, allow up to one point for accurately writing the syntax of each line of the control-of-flow statement specified in the instructions.

Instructions

In this exercise, you'll write pseudo-code to declare a variable to hold a user ID. Your code should incorporate the following:
  1. Assume the variable has a value and test to see if the user has access to the database.
  2. If the user does not have access, then exit the procedure.
  3. If the user does have access, then continue with the procedure.
  4. Take a stab at the datatype, although you will not be held responsible for this as we haven't covered it yet. And don't worry if you don't know how to check in the database that a specific user has access--we'll get to that in a bit, as well.
Reviewing your answer
Use the text box for your practice answer, then follow the reference-answer link to compare your work. Nothing is submitted or saved.

View the reference answer — self-assessment only