Database Concepts, assignment 1 Page 1 of 4
BIS 234, Semester 1, 2018
Database Concepts Assignment 1 Part B and Part C
Prepared By: Dr Jamal El-den, Craig Coley
Due date: Friday, Week 7
Value:
Part B 4% tables and advanced queries
Part C 10% covers all topics
Submission details:
• You already have Part 1 of this assignment. Part B and C are below
• Please submit all 3 parts of the assignments together.
• For Internal and External students: submission is via Learnline. Instructions on how to
submit the assignment is located under Assessments / Guidelines.
Part B: Table and Advanced Queries
Please answer all four questions.
For Question 1 provide the following:
• The SQL statement (4 of the marks)
For Question 2 provide the following:
• The SQL statement (3 of the marks)
For each Question 3 and 4 you have to provide the following:
• The SQL statement (3 of the marks)
Database Concepts, assignment 1 Page 2 of 4
1. The following Gym application database for weight session recording is as follows
Write and run SQL statements for the Occurrence_exercise table.
OCCURENCE
OccurenceID Occ_ Date Occ_Place Occ_Start_Time Occ_Finish_Time
OCCURRENCE_EXERCISE
OccExID ExerciseNo OccurenceID REP Attempt1 Attempt2 Attempt3 Condition
EXERCISE
ExerciseNo ExerciseDecription ExerciseType
Include constraints values for the Condition: Heavy, Medium, Light
2. Write an SQL statement that will insert the data into Occurrence_Exercise table only.
OCCURENCE
OccurrenceID Occ_ Date Occ_Place Occ_Start_Time Occ_Finish_Time
0001 14 MAR 18 University Gym 16:00 16:30
0002 15 MAR 18 University Gym 16:30 17:00
0003 16 MAR 18 University Gym 16:10 17:20
0004 17 MAR 18 Home 7:00 8:00
0005 17 MAR 18 University Gym 17:00 18:00
OCCURRENCE_EXERCISE
OccExID ExerciseNo OccurrenceID REPS Attempt1
(kg)
Attempt2
(kg)
Attempt3
(kg)
Condition
9001 001A 001 8 15 15 15 Light
9002 002A 001 8 70 75 70 Medium
9003 003A 002 12 90 95 90 Heavy
9004 004A 003 12 200 200 200 Medium
9005 006A 003 8 110 110 115 Heavy
9006 005A 004 10 20 25 Medium
9007 001A 004 8 10 12 10 Medium
9008 002A 005 8 85 90 115 Heavy
Database Concepts, assignment 1 Page 3 of 4
EXERCISE
ExerciseNo ExerciseDecription ExerciseType
001A Situps Abs
002A Bench Press Chest
003A Dead Lifts Back
004A Leg Press Legs
005A Seated Shoulder Press Shoulders
006A Squats Legs
007A Lat pull downs Lats
Definition of rep stands for repetition.
Each exercise attempt has the rep number as indicated in the occurrence table.
Create the following queries
3. Find the exercise which contains the maximum total weight lifted
Show: Exercise, Maximum weight
Ensure you show captions for each of the columns
Hint: you would need to consider the number of times the weight is lifted and weight e.g.
rep multiplied by attempt
4. Find the exercise that the user .
1. Database Concepts, assignment 1 Page 1
of 4
BIS 234, Semester 1, 2018
Database Concepts Assignment 1 Part B and Part C
Prepared By: Dr Jamal El-den, Craig Coley
Due date: Friday, Week 7
Value:
Part B 4% tables and advanced queries
Part C 10% covers all topics
Submission details:
• You already have Part 1 of this assignment. Part B and C are
below
• Please submit all 3 parts of the assignments together.
• For Internal and External students: submission is via
Learnline. Instructions on how to
submit the assignment is located under Assessments /
Guidelines.
Part B: Table and Advanced Queries
2. Please answer all four questions.
For Question 1 provide the following:
• The SQL statement (4 of the marks)
For Question 2 provide the following:
• The SQL statement (3 of the marks)
For each Question 3 and 4 you have to provide the following:
• The SQL statement (3 of the marks)
Database Concepts, assignment 1 Page 2
of 4
1. The following Gym application database for weight session
recording is as follows
Write and run SQL statements for the Occurrence_exercise
table.
OCCURENCE
OccurenceID Occ_ Date Occ_Place Occ_Start_Time
Occ_Finish_Time
3. OCCURRENCE_EXERCISE
OccExID ExerciseNo OccurenceID REP Attempt1 Attempt2
Attempt3 Condition
EXERCISE
ExerciseNo ExerciseDecription ExerciseType
Include constraints values for the Condition: Heavy, Medium,
Light
2. Write an SQL statement that will insert the data into
Occurrence_Exercise table only.
OCCURENCE
OccurrenceID Occ_ Date Occ_Place Occ_Start_Time
Occ_Finish_Time
0001 14 MAR 18 University Gym 16:00 16:30
0002 15 MAR 18 University Gym 16:30 17:00
0003 16 MAR 18 University Gym 16:10 17:20
0004 17 MAR 18 Home 7:00 8:00
0005 17 MAR 18 University Gym 17:00 18:00
OCCURRENCE_EXERCISE
5. 001A Situps Abs
002A Bench Press Chest
003A Dead Lifts Back
004A Leg Press Legs
005A Seated Shoulder Press Shoulders
006A Squats Legs
007A Lat pull downs Lats
Definition of rep stands for repetition.
Each exercise attempt has the rep number as indicated in the
occurrence table.
Create the following queries
3. Find the exercise which contains the maximum total weight
lifted
Show: Exercise, Maximum weight
Ensure you show captions for each of the columns
Hint: you would need to consider the number of times the
weight is lifted and weight e.g.
rep multiplied by attempt
6. 4. Find the exercise that the user was not able to complete 3
attempts in, or the exercise
that the user has not attempted.
• Show appropriate columns
• List in ascending order exercise type.
• Do not show repeated names
Ensure you show captions for each of the columns
Database Concepts, assignment 1 Page 4
of 4
Part C:
For the first four questions refer to the Library Database
For question 5 refer to CDU Customer invoice Database
Please answer all five questions.
For each question you have to provide the following:
• The SQL statement (3 of the marks) except for question 4 (4
of the marks)
Using Library Database
7. 1. What are the 5 most popular books?
• Show ASBN, Title
HINT: To limit results use ROWNUM.
2. Which branches currently have no loans out?
• Show all branch names
• List in ascending order by branch.
3. Find the longest time a book has been loaned out for each
branch
• Show only branch name and number of days
• List in ascending order by branch name
• Show all branches
• A branch may have a null value
• Format the number of days to one decimal place
4. Find the borrower that has returned a book on the dated 16
December 2010
and 8 May 2012
Show two different methods
5. Devise a delete query, which will eliminate duplicates for
columns customer id,
customer last name, customer first name, Invoice date, Invoice
No.
Ensure the query removes all duplicate data.
8. Overall grade
SQL Code/ tables/printout
Correct code
Description
Correct answers
· All attribute
· Criteria
· Correct syntax
· Most answers are correct
· All attribute
· Criteria
· Correct syntax
· Most answers are correct
· Some things overlooked
· All attribute
· Criteria
· Correct syntax
· Most answers correct
· Some things overlooked
· Concepts understood
· Some answers incorrect or missing
· Some problems
· Incorrect answers
· May have misunderstood the question
9. Excellent
Well done
Very good
OK
Need to review
HD
D
C
P
F
Some things to look out for
· Correct attributes given
· Correct use of Operators
· Linkages
· Capitals used for SELECT, FROM, WHERE, GROUP BY,
HAVING, ORDER BY, AND, OR
· Tables
· Linkage
· Correct concept in undertaking the questions
· And more
· Correct output (indicated in your document)
Note Question 4
· The mark is based on whether the question is answered
correctly.
· Complexity of the query e.g. a query that goes beyond the
content will gain a high grade where as a single table query
with no condition will gain less than a pass.
· Correct Syntax
· See also some things to look out for.
10. Database Concepts Assignment 1 Part A
Due date: Friday, Week 7
Value: 6%
Submission details:
For Internal and External students: submission is via Learnline.
Instructions on how to submit the assignment is located under
Assessments / Guidelines.
.
Part A: Single and multiple table queries
Please answer all 6 questions.
For five questions you have to provide the following
· SQL statement (3 of the marks)
For question 4 you have to provide the following:
· Written question, SQL statement to answer the question (3 of
the marks)
1. List in ascending order the Last Names of all borrowers with
Card Number less than 150.
2. What are the records of those loans between 3 June 2014 and
8 Mar 2018?
· The output should include the name of the cardholder, and
title of the book.
· List in ascending order by last name and first name
3. Find the total numbers of loans with last name beginning
with D until E; include last name beginning with Q as well as Z
also.
4. Create your own question based on the library Database and
with a SQL Statement to answer this.
11. 5. Find all borrowers for a loan that have the Date-in before 15-
March-15 and the Card number between 100 and 300 in Karama
or Darwin.
6. Find the number of loans, which have been made from each
branch?
· Note all branches need to be included even those with no loans
Page 1 of 1
Overall grade B and C
SQL Code/ tables/printout
Correct code
Description
Correct answers
· All attribute
· Criteria
· Correct syntax
· Most answers are correct
· All attribute
· Criteria
· Correct syntax
· Most answers are correct
· Some things overlooked
· All attribute
· Criteria
· Correct syntax
· Most answers correct
· Some things overlooked
· Concepts understood
· Some answers incorrect or missing
12. · Some problems
· Incorrect answers
· May have misunderstood the question
Excellent
Well done
Very good
OK
Need to review
HD
D
C
P
F
Some things to look out for
Part b 1,2
· Correct attributes given
· Correct use of commands
· Linkage
· Capitals used for command and Attribute type e.g. CREATE
TABLE
· Correct concept in undertaking the questions
Part b 3,4 and C
· Correct attributes given
· Correct use of Operators
· Linkages
· Capitals used for SELECT, FROM, WHERE, GROUP BY,
HAVING, ORDER BY, AND, OR
· Tables
13. · Linkage
· Correct concept in undertaking the questions
· And more
· Correct output (indicated in your document)