IT305
IT305
Assignment 1 Draft
Instructor: Twana Shareef
By: Abdulrahman Hussain Ali
21/Oct/2023
Contents
Project Overview........................................................................................................................................3
1.1 Advantage and Effect:.......................................................................................................................3
Project Scope..........................................................................................................................................4
Project Team...........................................................................................................................................4
Timeline..................................................................................................................................................4
Entity – Relation Diagram...........................................................................................................................5
Explanation.............................................................................................................................................6
Relationships:..........................................................................................................................................7
Relation Database Schema.........................................................................................................................8
Data Type Selection..................................................................................................................................10
Constraints Implementation.....................................................................................................................11
Project Overview
Project Objective: The major objective of this project is to develop and maintain a complete
database management system for Notown Records that efficiently arrange and handles
information on artists, instruments, songs, albums, locations, and phone records. Data retrieval
and management should be streamlined, interactions between different firm entities should be
facilitated, and data integrity should be guaranteed by the database system.
Important characteristics:
1. Data Storage: By storing details on artists, instruments, tracks, albums, locations, and phone
numbers, Notown Records is able to keep a centralized and orderly database of data.
2. Data Integrity: The system makes sure that the data is correct and consistent by enforcing
data integrity through the use of primary keys, foreign keys, and constraints.
3. Relationship Management: It oversees intricate connections between various entities,
including those that are many-to-many between artists and instruments, artists and songs, and
many-to-many between artists and producers, albums and songs, phones and locations, etc.
4. Search and Retrieval: Users may easily locate information about performers, albums, songs,
and more thanks to the system's effective search and retrieval capabilities.
5. Producer Information: Specifically, the system tracks the association between albums and the
musicians who produce them, ensuring that each album is linked to its respective producer.
6. Telephone and Address Linking: Telephone records are linked to specific places (addresses),
providing a means to organize contact information and link telephones to locations.
Project Scope: The database system's design, development, and implementation are all included in
this project. It offers features for data entry, data retrieval, and the creation of an intuitive user interface
for controlling the database. The project's scope may also include ongoing upkeep and assistance.
Project Team: A cross-functional team from Notown Records that includes database designers,
developers, administrators, and end users may be involved in the project.
Timeline: Depending on the system's complexity and particular requirements, the project's timeline
may change. Phases such as database design, development, testing, and deployment could be included
Entity – Relation Diagram
Explanation:
Musicians Table
This table serves as the core of the database, containing data about musicians. It is structured
with the musician's Social Security Number (SSN) as the primary key, ensuring each musician
has a unique identifier. The "Name" attribute stores the musician's name.
instrument Table
The information about musical instruments is gathered in the instrument table. A distinctive
"instrId" is used to identify each instrument. The "key" feature keeps track of the instrument's
related musical key, such as C or B-flat. The name of the instrument is stored in the "Dname"
element.
Songs Table
This table serves as a repository for song-related data, with "SongId" acting as the primary key.
The song's title is stored in the "Title" element, and the author's name is kept in the "Author"
attribute.
Album Table
This table stores information on albums and uses "albumIdentifier" as its main key. It includes
crucial details including the title, album speed, and copyright date. The "ProducerSSN" feature
also creates a connection to the musician in charge of the album's production, guaranteeing a
one-to-many linkage between albums and producers.
Place Table
This table focuses on representing physical locations or addresses. Each address is uniquely
identified by the "Address" attribute, which serves as the primary key.
Telephone table
This table contains phone numbers, with "Phone_no" serving as the primary key. In order to
preserve correspondence between phone numbers and addresses, the "Address" attribute
serves as a foreign key, creating a connection between phone numbers and certain locations.
Relationships:
Name VARCHAR(255)
);
Key VARCHAR(10),
Dname VARCHAR(50)
);
Title VARCHAR(255),
Author VARCHAR(255)
);
CopyrightDate DATE,
Speed INT,
Title VARCHAR(255),
ProducerSSN CHAR(9),
);
Address VARCHAR(255),
);
MusicianSSN CHAR(9),
InstrumentID INT,
);
MusicianSSN CHAR(9),
SongID INT,
);
Create a foreign key constraint to ensure each song appears on exactly one album
1. Musicians Table:
- SSN: CHAR(9) - Social Security Numbers (SSN) typically consist of 9 characters, making CHAR(9) an
appropriate choice to store them.
- Name: VARCHAR(255) - Names can vary in length, so VARCHAR(255) provides flexibility to store
names of different lengths.
2. Instrument Table:
- instrID: INT - An integer data type is suitable for a unique instrument identifier.
- Key: VARCHAR(10) - Musical keys are typically represented as short strings (e.g., C, B-flat), and
VARCHAR(10) allows for flexibility in storing various key values.
- Dname: VARCHAR(50) - Instrument names are text descriptions, and VARCHAR(50) is sufficient for
most instrument names.
3. Song Table:
- SongID: INT - An integer data type is appropriate for a unique song identifier.
- Title: VARCHAR(255) - Song titles can vary in length, so VARCHAR(255) accommodates titles of
different lengths.
- Author: VARCHAR(255) - Author names can vary in length, so VARCHAR(255) provides flexibility.
4. Album Table:
- albumIdentifier: INT - An integer data type is suitable for a unique album identifier.
- CopyrightDate: DATE - Copyright dates are best represented as dates, and DATE is used for date-
related operations.
- Speed: INT - Assuming "Speed" represents a numerical attribute, INT is a suitable choice for an
integer value.
- Title: VARCHAR(255) - Album titles can vary in length, so VARCHAR(255) is used to store them.
- ProducerSSN (Foreign Key): CHAR(9) - To ensure that the "ProducerSSN" references an existing SSN in
the Musicians table, it uses the same data type (CHAR(9)).
5. Place Table:
6. Telephone Table:
- Phone_no: VARCHAR(15) - Phone numbers can vary in length, and VARCHAR(15) allows for the
storage of different phone number formats.
- Address (Foreign Key): VARCHAR(255) - To ensure that "Address" references an existing address in
the Place table, it uses the same data type (VARCHAR(255)).
Constraints Implementation
- Primary Key constraints to ensure uniqueness and identify primary keys for SSN, instrID, SongID,
albumIdentifier, Address, and Phone_no.
- Foreign Key constraints to enforce referential integrity in the relationships between tables (e.g.,
ProducerSSN in the Album table and AlbumID in the Song table).
- A unique constraint on Phone_no to ensure that each telephone number is unique within the
Telephone table.
- Primary Key constraints ensure that each primary key is unique within its respective table, allowing
for efficient data retrieval.
- Foreign Key constraints maintain referential integrity, ensuring that relationships between tables are
accurate and that related data exists.
- The unique constraint on Phone_no prevents duplicate phone numbers within the Telephone table,
helping to maintain accurate and unique phone records.
c) I have added the following ALTER statement to introduce a foreign key constraint to ensure that each
song appears on exactly one album. This constraint helps enforce the one-to-many relationship between
songs and albums