Due: see class web page
Before you start on this project, you must read
You must read the information/description on the SPJ project database in the URL below to do the project.
Specifically: pay attention to what the meaning of each relation is.
How to do SQL projects:
|
/home/cs377001/bin/cs377-sql |
To access the SPJ database, you must enter:
spjDB |
in the database field and click the select button.
Notes:
|
Note: You should be aware that sometimes, an incorrect query can produce the same outputs as the right query. Incorrect queries that happens to produce the same answers as the solution query will not receive full credits. In fact, we use a different database content to grade the SQL projects, so do NOT rely solely on visual output to check for correctness. You should understand SQL and the techniques discussed in class.
|
You should use one file to hold one SQL query.
Follow the following guidelines for each file:
|
|
To usage of the command is as follows (you need to provide 2 parameters):
/home/cs377001/bin/chsql SQL-proj# Question_Number |
Use SQL-proj# = 1 in this assignment (use SQL-proj# = 2 in the next SQL assignment).
To check what SQL query for problem 1 would return, run:
/home/cs377001/bin/chsql 1 1To check what SQL query for problem 2 would return, run:
/home/cs377001/bin/chsql 1 2And so on.
|
Express the following queries in SQL:
Sample output:
+------+ | pnum | +------+ | p1 | | p4 | | p6 | +------+ |
Answer: click here
Sample output:
+------+ | jnum | +------+ | j1 | | j4 | | j17 | | j18 | | j19 | | j14 | +------+ |
Answer: click here
Sample output:
+------+ | snum | +------+ | s7 | | s9 | | s11 | +------+ |
Answer: click here
Sample output:
+------+ | snum | +------+ | s1 | | s2 | | s5 | | s6 | | s7 | | s8 | | s9 | | s10 | | s11 | | s12 | | s13 | +------+ |
Answer: click here
Sample output:
+------+ | jnum | +------+ | j6 | | j14 | +------+ |
Answer: click here
Sample output:
+------+------+ | snum | pnum | +------+------+ | s1 | p2 | | s2 | p3 | | s3 | p3 | | s4 | p6 | | s5 | p6 | | s6 | p6 | | s7 | p3 | | s8 | p2 | | s8 | p3 | | s9 | p2 | | s10 | p1 | | s11 | p8 | | s12 | p8 | | s13 | p6 | +------+------+ |
Answer: click here
Sample output:
+------+ | snum | +------+ | s13 | | s3 | | s4 | | s9 | +------+ |
Answer: click here
Sample output:
+------+ | snum | +------+ | s10 | | s12 | +------+ |
Answer: click here
Suppose project j6 uses parts p1, p2 and p3. Then find suppliers that have shipments for all these parts in the spj relation. The supplier does not need to ship these parts to project j6.
Sample output:
+------+ | snum | +------+ | s12 | | s13 | | s2 | | s3 | | s4 | | s5 | | s6 | | s7 | | s8 | +------+ |
Answer: click here
E.g.: if project X is in Atlanta and the suppliers S1 and S2 live in Atlanta, than project X must have shipments from supplier S1 and S2 in the spj relation
Sample output:
+------+ | jnum | +------+ | j1 | | j2 | | j3 | | j5 | | j7 | +------+ |
Answer: click here
/home/cs377001/turnin filename sql1-XX |
Use for XX the query number in the handout. (XX ranges from 1, 2, 3, 4, 5, ...., 20).
For example, if your file ans5.sql contains the solution to query 5, use the command:
/home/cs377001/turnin ans5.sql sql1-5to turn in your solution. Do NOT use a leading 0 !
Each query must be stored as a separate file and turned in separately.
Also, make sure you work in your cs377 project directory to protect your files from illegal access.
Extension request
/home/cs377001/req-ext sql1 |
You request will be successful if you have not exceeded the maximum number of "free" (no-questions-asked) requests allowed
Students will be graded partially on the basis of their programming assignments. These programming assignments are to be treated as examinations, and are expected to be your individual work. While discussions with other students in the course may be permitted or encouraged by your instructor, you should write your program yourself. The mathlab representatives are available to explain error messages, discuss briefly technical details with which you may not be familiar, and give short suggestions as to how you might detect logic errors. The reps should not, however be asked to write part or all of your program. Your instructor (and any teaching assistants assigned to the course) will be glad to help you to the extent that he or she feels reasonable.
Submissions based on other students solutions in prior offerings of the course specifically violate these guidelines, as do submissions prepared with the help of an outside "tutor".
You should take precautions to protect the confidentiality of your work: preserve the secrecy of your password, do not make files or directories sharable, pick up your printouts promptly and dispose of printouts where they will not tempt other students. All work should be done either in the class directory of your ITD account (preferred) or in your "priv" directory (only if you do not have a class directory).
All submissions should include a comment statement near the top of the program of the form:
THIS CODE IS MY OWN WORK, IT WAS WRITTEN WITHOUT CONSULTING A TUTOR OR CODE WRITTEN BY OTHER STUDENTS - your name
Cases of apparent plagiarism or collusion will be referred to the Honor Council.