Instructions
For Parts 1 and 2, include screenshots that show the queries and outputs. For Part 3, feel free to type the
answers or to write them by hand and scan them. Upload PDF documents to webcampus.
Part 1
Perform the following operations in the Oracle database server located at opus.fdu.edu.
- Create a table named Customers with columns CustomerID (auto-incremented primary key), Cus
tomerName (non-nullable), CustomerCountry (non-nullable).
- Add three customers.
- Create a view named CustomerInfo with columns PersonName and Country.
- Display the view CustomerInfo.
- Create a table named Employees with columns EmployeeID (auto-incremented primary key), First
Name (non-nullable), LastName (non-nullable), EmployeeCountry (non-nullable).
- Add three employees, two of whom must also be customers.
- Create a view named EmployeeInfo with columns PersonName and Country.
- Display the view EmployeeInfo.
- Using the two views created above, display the PersonName and Country information of every person
who is:
(a) A customer or employee or both.
(b) Both a customer and an employee.
(c) A customer but not an employee. Hint: The Oracle keyword for except is minus.
(d) An employee but not a customer.
1Part 2
Perform the following operations in the Oracle database server located at opus.fdu.edu, or in an Azure
SQL database.
- Create a table named Students with columns StudentID (auto-generated, globally unique, primary
key), StudentName (non-null).
- Add three students.
- Create a table named Courses with columns CourseID (auto-generated, globally unique, primary key),
CourseName (non-null).
- Add three courses.
- Create a table named Enrollments with column StudentID, CourseID. Hint: Both should be foreign
keys.
- Enroll the students in courses such that there is one student who has not enrolled in any courses
yet, and one course that doesn’t have any enrolled students yet.The remaining students must each be
enrolled in each of the remaining courses.
- Using SQL queries, fifind:
(a) The student name and course name for every existing enrollment.
(b) The names of all students not enrolled in any courses.
(c) The names of all courses with no enrolled students.
Part 3 (20 points)
In relational algebra, consider the following scenario. Table A has the following contents (fifirst row gives
column names):
AuthorID SubjectID
1 1
2 1
3 2
4 2
5 2
6 3
Table B has the following contents (fifirst row gives column names):
SubjectID SubjectName
1 Computer Networks
2 Algorithms
4 Applied Statistics
For each of the following, write the relational algebra expression and the corresponding results:
- Cartesian product of A and B.
- Inner join between A and B.
- A left outer join B.
- A right outer join B.
- A full outer join B.
Background Information
This assignment tests your understanding of and ability to apply the programming concepts we have covered in the unit so far, including the usage of variables, input/output, data types, selection, iteration, functions and data structures.
Pseudocode
As emphasised in the case study of Module 5, it is important to take the time to properly design a solution before starting to write code. Hence, this assignment requires you to write and submit pseudocode of your program design as well as the code for the program. Furthermore, while your tutors are happy to provide help and feedback on your assignment work throughout the semester, they will expect you to be able to show your pseudocode and explain the design of your code.
Write a separate section of pseudocode for each function in your program.
Assignment Requirements
You are required to design and implement a “Golf Club” program that records information about golfers and tournaments. The program should have a menu system as shown below.
Implement all of the following requirements, and ask your tutor if you do not understand any of the requirements.
- The program should welcome the user and display the menu.
- Re-prompt the user until a valid response (1, 2, 3 or 4) is entered.
- The Enter Scoresoption should ask the user how many golfers in the group and then ask to enter the following information about each golfer and put the information into some data structure(s) as appropriate:
- Name
- Result (this is the number of stokes taken – it ranges between 18 to 108)
- If a name matches a name already in the data structure, the user should be warned that the result will be altered and given the option to keep existing data.
- The Find Golferoption should allow the user to enter a name and if the name is in the data structure should display their score, if the name is not found it should display an appropriate message.
- The Display Scoreboardoption should display ALL golfers entered and their score, in order of best (lowest score) to highest.
- The Exit Program option should display an appropriate message and the program should exit.
Submission of Deliverables
Once your assignment is complete, submit both your pseudocode (PDF or DOC format – no .pages files) and source code (“.py” file) to the appropriate locations on moodle. An assignment cover sheet is not required, but be sure to include your name and student number at the top of both files.
Referencing, Plagiarism and Collusion
The entirety of your assignment must be your own work (unless otherwise referenced) and produced for the current instance of the unit. Any use of unreferenced content you did not create constitutes plagiarism, and is deemed an act of academic misconduct. All assignments will be submitted to plagiarism checking software which includes previous copies of the assignment. Remember that this is an individual assignment. Never give anyone any part of your assignment – even after the due date or after results have been released. Do not work together with other students on individual assignments – helping someone by explaining errors in their code/logic or directing them to the relevant resources is appropriate, but doing it for them or showing them how you did it is not. An unacceptable level of cooperation between students on an assignment is collusion, and is deemed an act of academic misconduct. If you are uncertain about plagiarism, collusion or referencing, simply email your tutor, lecturer or unit coordinator and ask.
Part 2
Marking Key
Marks are allocated as follows for this assignment. Criteria |
Marks |
Pseudocode These marks are awarded for submitting pseudocode/flowcharts which suitably represent the design of your source code. Pseudocode and flowcharts will be assessed on the basis of “does it help in understanding/describing the structure and flow of the program?” |
5 |
Functionality These marks are awarded for submitting source code that implements the requirements specified in this brief. Code which is not functional or contains syntax errors will lose marks, as will failing to implement requirements as specified. |
10 |
Code Quality These marks are awarded for submitting well-written source code that is efficient, well-formatted and demonstrates a solid understanding of the concepts involved. This includes appropriate use of commenting and adhering to best practise. |
5 |
Total: |
20 |
Code:
#include
#include
#include
void display_deatails(char name[], int number, int stroke[] )
{
int i;
for(i=0; i<number; i++)
{
printf("nName %s",name[i]);
printf("nNumber of Strokes %d",stroke[i]);
printf("n");
}
}
void score(int score[], int s)
{
long j, k, temp;
for (j = 0 ; j < ( s - 1 ); j++)
{
for (k = 0 ; k < s - j - 1; k++)
{
if (score[k] > score[k+1])
{
/* Swapping */
temp = score[k];
score[k] = score[k+1];
score[k+1] = temp;
}
}
}
}
void find(char name[], int n, char search)
{
int j;
for(j=0; j<n; j++)
{
if (name[j] == search )
{
printf("Score of %s player is : %dn", search, j+1);
break;
}
}
if( j == n )
printf("%s name is not found. Enter another name.n", search);
}
int main()
{
int a,b,c,select,i,j,temp;
int g_number;
int g_stroke[100];
char g_name[100], search;
float d;
do{
printf("nWelcome to Springfield Golf Club.");
printf("nSelect Option :");
printf("nt1)tEnter_Scores");
printf("nt2)tFind Golfer ");
printf("nt3)tDisplay Scoreboard ");
printf("nt4)tExit Program ");
printf("nSelect an Option (1-4) : ");
scanf("%d",&select);
switch(select)
{
case 1: printf("nEnter how many golfers is present in the group? ");
scanf("%d",&g_number);
printf("nEnter the golfer name and stroke:");
for(i=0; i<g_number; i++)
{
scanf("%s",g_name);
scanf("%d",&g_stroke[i]);
}
printf("nInformation of each golfer:");
display_deatails(g_name,g_number,g_stroke);
break;
case 2: printf("nEnter the name of the golfer you want to display score :");
scanf("%s",search);
find(g_name,g_number,search);
break;
case 3: printf("Display all golfers and their scores:n");
display_deatails(g_name,g_number,g_stroke);
score(g_stroke,g_number);
printf("Score, in order of best (lowest score) to highest.");
for(i=0; i<g_number; i++){
printf("n%d",g_stroke[i]);
}
break;
case 4:
printf("Program terminated. ");
exit(0);
break;
default:
printf("nInvalid selection!! Please select the correct option.");
}
}while(select <= 4 && select > 0);
return 0;
}
Pseudo Code
Function Main
Declare integer variables i, j, n, ch
Declare string of arrays a, b, c of size 20
Declare character variable x
Do
Display Menu
Take user’s choice as input
Switch case (Controlling Expression)
Case 1
Take input for number of golfers present in the group
Take input the name and result of the golfers
Case 2
Search name of golfer
If identical data found, display data
Case 3
Display all details of golfers
Case 4
Exit from the program
Default
Invalid entry
End of do while loop
End of main function
Source Code
#include
#include
#include
int main ()
{
int ch,n,j,i;
char a[20], b[20], c[20];
char x;
do
{
printf ("Welcome to the Springfield Golf Club n");
printf ("Select Option : n");
printf ("1) Enter Scores n");
printf ("2) Find Golfer n");
printf ("3) Display Scoreboard n");
printf ("4) Exit Program n");
printf ("Enter your choice : n");
scanf ("%d", &ch);
switch(ch)
{
case 1:
printf ("Enter the number of golfers in the group : n");
scanf ("%d", &n);
for(i=0;i<n; i++)
{
Printf ("Enter name of golfer : n");
Scanf ("%s", &a[i]);
Printf ("Enter result of golfer : n");
Scanf ("%s", &b[i]);
}
break;
case 2:
printf ("Enter the number of golfers : ");
scanf ("%d", &n);
printf("Enter name of the golfer : n");
scanf("%s", &c);
//printf("%s n ",a);
for (i=0;i<n; i++)
{
If (strcmp (a,c) = = 0)
{
Printf ("%s n ", a[i]);
}
}
break;
case 3:
printf ("Enter the number of golfers : n");
scanf ("%d", &n);
printf ("%d n",*a);
printf ("%d n",*b);
for (i=0 ;i<n; i++)
{
Printf ("%d t ", a[i]);
}
For (j=0; j
{
Printf ("%d n ", b[i]);
}
break;
case 4:
break;
default:
printf ("Invalid option..please insert valid option n");
printf ("n");
}
} while (ch!=4);
return 0;
}
To export a reference to this article please select a referencing stye below:
My Assignment Help. (2019). Essay On Golf Club Program And Database Operations In Oracle And Azure SQL Database.. Retrieved from https://myassignmenthelp.com/free-samples/csci-3268-oracle-database-server.
"Essay On Golf Club Program And Database Operations In Oracle And Azure SQL Database.." My Assignment Help, 2019, https://myassignmenthelp.com/free-samples/csci-3268-oracle-database-server.
My Assignment Help (2019) Essay On Golf Club Program And Database Operations In Oracle And Azure SQL Database. [Online]. Available from: https://myassignmenthelp.com/free-samples/csci-3268-oracle-database-server
[Accessed 22 December 2024].
My Assignment Help. 'Essay On Golf Club Program And Database Operations In Oracle And Azure SQL Database.' (My Assignment Help, 2019) <https://myassignmenthelp.com/free-samples/csci-3268-oracle-database-server> accessed 22 December 2024.
My Assignment Help. Essay On Golf Club Program And Database Operations In Oracle And Azure SQL Database. [Internet]. My Assignment Help. 2019 [cited 22 December 2024]. Available from: https://myassignmenthelp.com/free-samples/csci-3268-oracle-database-server.