Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

CSCU9B3 Relational Database Assignment 2022

Computing Science and Math’s, University of Stirling

70% of module grade

Due: 12PM Monday 21st Nov 2022


Contents
Relational database.....................................................................................................................................3
Diagram...................................................................................................................................................3
Explanation..............................................................................................................................................4
Entity Relationship Diagram........................................................................................................................4
Explanation..............................................................................................................................................5
Relational database

A database type known as a relational database organizes and stores connected data items.
Data is arranged into connected tables depending on common data. They are the most typical
database type utilized by companies today. With a database like this, you may do a single query
that searches over one or maybe more tables.

Diagram

Player
Skills
ID(PK) ID(PK)

DOB
Skills(FK)
Team(FK)

Status

Team

Game
Name(PK)
Venue Room(PK)
Team
Name(FK)
Postcode
Venue

Date

Points
Explanation

Player has a unique ID attribute, so we set it as the primary key and we set team name as foreign key to
connect the player and team tables. As skill is a multivalued attribute it gets its own table which will
have the player ID as primary and foreign key and the skill as a primary key. ID is a foreign key to
connect the players and the skill tables.

Team will have the team name as a primary key because no two teams will have the same name. And
finally we set venues room as the primary key for the game table. We also set player ID as a foreign key
to connect the player and Game table.

Entity Relationship Diagram

Entity relationship diagrams offer a visual starting point for database architecture and may also
be used to assist identify the needs of an organization's information systems.

Explanation

The relationship between player and team is a one to many as one team can have zero or many players.
The relationship between player and skill is one to many as one player can have one or many skills. The
relationship between player and game is one to many as one player can be in one or many games.
Database

I have used phpmysql database via XAMPP server

SQL queries

(i) SELECT *

FROM data

WHERE DateofBirth>('1990-1-1');

(ii) select DateofBirth, sum(DateofBirth)

from data;

(iii) SELECT COUNT(points) AS 'Point Count'

FROM Data

You might also like