A company needs a stored procedure that will insert a new user with an appropriate type.
Consider the following tables:
TABLE userTypes id INTEGER NOT NULL PRIMARY KEY, type VARCHAR(50) NOT NULL TABLE users id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, email VARCHAR(50) NOT NULL, userTypeId INTEGER NOT NULL, FOREIGN KEY (userTypeId) REFERENCES userTypes(id)
Finish the insertUser procedure so that it inserts a user, with these requirements:
- id is auto incremented.
- email is equal to the email parameter.
- userTypeId is the id of the userTypes row whose type attribute is equal to the type parameter.
See the example case for more details.
- Example case: Wrong answer
- There is only one row in the userTypes table: Wrong answer
- There are several rows in the userTypes table: Wrong answer