This document provides a detailed explanation of database design and implementation. It includes an enhanced entity relationship diagram, database entities, script, views, and queries. The document also includes a bibliography.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head:DATABASE DESIGN AND IMPLEMENTATION Database Design and Implementation Name of the Student Name of the University Author’s note:
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
1DATABASE DESIGN AND IMPLEMENTATION Table of Contents Enhanced Entity Relationship Diagram:.........................................................................................2 Database Entities:............................................................................................................................2 Script:...............................................................................................................................................5 Views:............................................................................................................................................18 Queries:..........................................................................................................................................19 Bibliography:.................................................................................................................................22
2DATABASE DESIGN AND IMPLEMENTATION Enhanced Entity Relationship Diagram: Figure 1: EERD of FIT CLUB Health Centre (Source: Created by Author) Database Entities: Classes Entity:
3DATABASE DESIGN AND IMPLEMENTATION Club Entity: Manager Entity: Facility Entity:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
16DATABASE DESIGN AND IMPLEMENTATION -- -- Indexes for table `member` -- ALTER TABLE `member` ADD PRIMARY KEY (`memberID`), ADD KEY `clubID` (`clubID`); -- -- Indexes for table `timetable` -- ALTER TABLE `timetable` ADD PRIMARY KEY (`classID`,`trainerID`,`classDate`), ADD KEY `trainerID` (`trainerID`); -- -- Indexes for table `trainers` -- ALTER TABLE `trainers` ADD PRIMARY KEY (`trainerID`), ADD KEY `clubID` (`clubID`); -- -- Constraints for dumped tables -- -- -- Constraints for table `classclub` -- ALTER TABLE `classclub`
17DATABASE DESIGN AND IMPLEMENTATION ADD CONSTRAINT `classclub_ibfk_1` FOREIGN KEY (`classID`) REFERENCES `classes` (`classID`), ADD CONSTRAINT `classclub_ibfk_2` FOREIGN KEY (`clubID`) REFERENCES `clubs` (`clubID`); -- -- Constraints for table `clubfacilities` -- ALTER TABLE `clubfacilities` ADDCONSTRAINT`clubfacilities_ibfk_1`FOREIGNKEY(`clubID`) REFERENCES `clubs` (`clubID`), ADDCONSTRAINT`clubfacilities_ibfk_2`FOREIGNKEY(`facilityID`) REFERENCES `facilities` (`facilityID`); -- -- Constraints for table `manager` -- ALTER TABLE `manager` ADD CONSTRAINT `manager_ibfk_1` FOREIGN KEY (`clubID`) REFERENCES `clubs` (`clubID`); -- -- Constraints for table `member` -- ALTER TABLE `member` ADD CONSTRAINT `member_ibfk_1` FOREIGN KEY (`clubID`) REFERENCES `clubs` (`clubID`); -- -- Constraints for table `timetable` -- ALTER TABLE `timetable`
18DATABASE DESIGN AND IMPLEMENTATION ADD CONSTRAINT `timetable_ibfk_1` FOREIGN KEY (`classID`) REFERENCES `classes` (`classID`), ADD CONSTRAINT `timetable_ibfk_2` FOREIGN KEY (`trainerID`) REFERENCES `trainers` (`trainerID`); -- -- Constraints for table `trainers` -- ALTER TABLE `trainers` ADD CONSTRAINT `trainers_ibfk_1` FOREIGN KEY (`clubID`) REFERENCES `clubs` (`clubID`); COMMIT; /*!40101SETCHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; Views: View 1:CREATE OR REPLACE VIEW AAclubmemberAS SELECT 'all-access members', c1.branchName, c1.state, man1.managerName, Count(mem1.clubID) AS 'Count of members' FROM clubs c1, member mem1, Manager man1 WHERE c1.clubID = mem1.clubID AND c1.clubID = man1.clubID AND mem1.type = 'AAMembers' GROUP BY c1.branchName; View 2:CREATE OR REPLACE VIEW COclubmember AS SELECT 'class-only members', c2.branchName, c2.state,man2.managerName, Count(mem2.clubID) AS 'Count of members' FROM clubs c2, member mem2, Manager man2 WHERE c2.clubID = mem2.clubID AND c2.clubID = man2.clubID AND type = 'COMember' GROUP BY c2.branchName;
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
19DATABASE DESIGN AND IMPLEMENTATION View 3:CREATE OR REPLACE VIEW ActiveMember AS SELECT 'Active Member', branchName, state, COUNT(member.clubID) AS 'Total number of members' FROM clubs INNER JOIN member ON clubs.clubID = member.clubID WHERE member.membershipStatus = 'Active' GROUP BY branchName; View 4:CREATE OR REPLACE VIEWOnLeaveASSELECT'HoldMember', branchName, state, COUNT(member.clubID) AS 'Total number of members' FROM clubs INNER JOIN member ON clubs.clubID = member.clubID WHERE member.membershipStatus = 'On Leave' GROUP BY branchName; View 5:CREATE OR REPLACE VIEWInactiveMemberASSELECT'Inactive Member', branchName, state, COUNT(member.clubID) AS 'Total number of members' FROM clubsINNERJOINmemberONclubs.clubID=member.clubIDWHERE member.membershipStatus = 'Inactive' GROUP BY branchName; Queries: Query 1:SELECT branchName, state, contactNumber FROM Clubs INNER JOIN ClubFacilitiesONClubs.clubID=ClubFacilities.clubIDINNERJOINFacilitiesON ClubFacilities.facilityID = facilities.facilityID ORDER BY state ASC; Query 2:Select memberName, address, contactNumber FROM member WHERE type = 'COMember' ORDER BY memberName;
20DATABASE DESIGN AND IMPLEMENTATION Query 3:SELECT * FROM aaclubmember UNION SELECT * FROM coclubmember; Query4:SELECTclubs.branchName,trainers.trainerName, COUNT(personaltraining.trainerID) AS 'Numbers of members trained' FROM personaltraining INNER JOIN trainers ON personaltraining.trainerID = trainers.trainerID INNER JOIN clubs ON trainers.clubID = clubs.clubID GROUP BY trainerName ORDER BY clubs.state; Query 5:SELECT managerName, email, manager.contactNumber, branchName FROM managerINNERJOINclubsONmanager.managerID=clubs.clubIDORDERBY managerName; Query6:SelecttrainerName,branchName,trainers.contactNumberFROMtrainers INNER JOIN clubs ON trainers.clubID = clubs.clubID WHERE specialized LIKE '%Weight Loss%' AND status = 'Active' ORDER BY trainerName;
21DATABASE DESIGN AND IMPLEMENTATION Query 7:SELECT * FROM activemember UNION SELECT * FROM onleave UNION SELECT * FROM inactivemember Query 8:SELECT className, trainerName, classDate, `time` FROM Timetable INNER JOINtrainersONTimetable.trainerID=trainers.trainerIDINNERJOINclassesON Timetable.classID = classes.classID ORDER BY classDate, `time`;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
22DATABASE DESIGN AND IMPLEMENTATION Bibliography: Al-Masree, H.K., 2015. Extracting Entity Relationship Diagram (ERD) from relational database schema.International Journal of Database Theory and Application,8(3), pp.15-26. Dionisio, K.L., Phillips, K., Price, P.S., Grulke, C.M., Williams, A., Biryol, D., Hong, T. and Isaacs, K.K., 2018. The Chemical and Products Database, a resource for exposure-relevant data on chemicals in consumer products.Scientific data,5, p.180125. Elbourne, L.D., Tetu, S.G., Hassan, K.A. and Paulsen, I.T., 2016. TransportDB 2.0: a database for exploring membrane transporters in sequenced genomes from all domains of life.Nucleic acids research,45(D1), pp.D320-D324. Fabregat, A., Korninger, F., Viteri, G., Sidiropoulos, K., Marin-Garcia, P., Ping, P., Wu, G., Stein, L., D’Eustachio, P. and Hermjakob, H., 2018. Reactome graph database: Efficient access to complex pathway data.PLoS computational biology,14(1), p.e1005968. Oktafianto, M.R., Al Akbar, Y.F., Zulkifli, S. and Wulandari, A.M., 2018. Dismissal Working Relationship using Analytic Hierarchy Process Method.International Journal of Pure and Applied Mathematics,118(7), pp.177-184. Stanescu, L., Brezovan, M. and Burdescu, D.D., 2016, September. Automatic mapping of MySQLdatabasestoNoSQLMongoDB.InComputerScienceandInformationSystems (FedCSIS), 2016 Federated Conference on(pp. 837-840). IEEE. Sun, Q., Fu, L., Qiu, W. and Sun, J., 2016. An automatic anti-attack scheme for mysql database.Advances in Intelligent Systems Research,113, pp.397-400.
23DATABASE DESIGN AND IMPLEMENTATION Trivedi, D., Zavarsky, P. and Butakov, S., 2016. Enhancing relational database security by metadata segregation.Procedia Computer Science,94, pp.453-458. Vaneman, W.K., 2016, April. Enhancing model-based systems engineering with the Lifecycle Modeling Language. InSystems Conference (SysCon), 2016 Annual IEEE(pp. 1-7). IEEE. Yang, L. and Cao, L., 2016. The Effect of MySQL Workbench in Teaching Entity-Relationship Diagram (ERD) to Relational Schema Mapping.International Journal of Modern Education and Computer Science,8(7), p.1.