To satisfy your participation points for this course, every week you must insert at least one question and answer into the database.
The detailed requirements for valid questions and answers are as follows:
- Must be on-topic for that week's chapter content.
- Must not be a duplicate of an existing question.
- Must not have already appeared on a quiz or an exam.
- Must be inserted any time on the respective Tuesday. Refer to class calendar for exceptions.
- Must be an answer to a valid question for the respective chapter.
- Must be an answer to someone else's question.
- Must not be a duplicate of an existing answer.
Log into VMWare and start SSMS (Microsoft SQL Server Management Studio).
Connect to essql1.walton.uark.edu
Expand the databases folder and create a new query in isys4283-2017fa
The basic syntax for an INSERT
statement is:
INSERT INTO <table name> (<column name>) VALUES (<value>);
For example, insert a question like this :
INSERT INTO questions (question) VALUES ('What is an ERD?');
Browse the questions by executing this SQL:
SELECT * FROM questions;
Protip: you can filter the current questions using a WHERE
clause.
SELECT * FROM questions
WHERE created_at >= '2017-08-22';
id | question | user_login | created_at | updated_at |
---|---|---|---|---|
42 | What is information? | jdoe | 2017-08-22 | 2017-08-22 |
43 | What is an ERD? | me | 2017-08-23 | 2017-08-23 |
Insert your answer passing the question id with it, for example:
INSERT INTO answers (question_id, answer)
VALUES (42, 'Data in context.');
Note the requirements for valid questions and answers. Use these more complex queries for a better overview of content to ensure you're compliant.
If you make a mistake, then you can use an UPDATE
statement to fix it.
UPDATE questions
SET question = 'What is metadata?'
WHERE id = 43;
In order to completely remove your content, use a DELETE
statement.
DELETE FROM questions
WHERE id = 43;
Remain cognizant of foreign key constraints. e.g. You won't be able to delete a question until all of the answers to it have been deleted first.
After questions and answers have been reviewed for validity,
then you can check your scores using the qascore
stored procedure.
The required parameters are due dates for question @qdate
and answer @adate
.
EXEC qascore @qdate = '2017-11-07', @adate = '2017-11-09'