Music Database
Music Database
Music Database
Databases provide us with information stored with a hierarchical and related structure, which allows us to
extract the content and arrange it easily. There are plenty of options to choose from for business and
companies. Even though MySQL is the most widespread database, there are other alternatives, such as
Microsoft SQL Server, PostgreSQL, or MongoDB.
Regardless of our choice, there are a number of common recommendations regarding the management
and optimization of the databases. Following these best practices will make your work easier, improving
the experience of our users.
No matter how carefully you plan the initial approach to the database, as time goes by, you inevitably end
up with unused tables. Just do not hesitate: delete them! Having unused tables is quite similar to keeping
things you don’t use in a full drawer. When you go looking for something, it can take you much longer to
find it! The same thing happens in the databases: the systems have to track all the tables and elements
until they find the answer to the query.
2. Proper Indexing
Having a good index among tables is essential for relational searches to work correctly. Add indexes to
the tables and use the query statements (SELECT, WHERE …). It is also advisable to periodically check
the registry of slow queries to identify those that should be optimized. No indexing at all or excessive
indexing are not a good idea. Without any indexing, the process will be prolonged, whereas indexing
everything will render the insert and update triggers ineffective
If any a code can be well written simply, there is absolutely no need to make it complex with temporary
tables. Subqueries usually alternate temporary tables, but keep in mind the precise performance that each
of these would provide in each case.
Avoiding coding loops is much required in order to prevent stalling the entire sequence. It can be
accomplished by employing the unique UPDATE or INSERT commands with individual rows and by
making sure that the WHERE command does not update the stored data in case it finds a preexisting
matching data.
Music Database Tables
Artist
);
Album
);
Track
);
Played
);
User
);
Favorite
Track_no SSN
Create table Favorite (
);
Download
Track_no SSN
Create table Download (
);
Query optimization
Genre = “slow”,
Album_no = Track.Album_no,
Artist_Id = Album.Artist_Id,
Ꙥ F_name, Track.name
Artist
x
Track Album
Step 2:
Ꙥ F_name, Track.name
Artist
x
σ Genre = “slow”
Album
Track