Question

In: Computer Science

Project: Building a Relational Database Management System  This project is where you show off your...

Project: Building a Relational Database Management System

 This project is where you show off your ability to (1) translate a business requirement into a database design, (2) design a database using one-to-many and many-to-many relationships, and (3) know when to use LEFT and/or RIGHT JOINs to build result sets for reporting.

An organization grants key-card access to rooms based on groups that key-card holders belong to. You may assume that users below to only one group. Your job is to design the database that supports the key-card system.

There are six users, and four groups. Modesto and Ayine are in group “I.T.” Christopher and Cheong woo are in group “Sales”. There are four rooms: “101”, “102”, “Auditorium A”, and “Auditorium B”. Saulat is in group “Administration.” Group “Operations” currently doesn’t have any users assigned. I.T. should be able to access Rooms 101 and 102. Sales should be able to access Rooms 102 and Auditorium A. Administration does not have access to any rooms. Heidy is a new employee, who has not yet been assigned to any group.

After you determine the tables any relationships between the tables (One to many? Many to one? Many to many?), you should create the tables and populate them with the information indicated above.

Next, write SELECT statements that provide the following information:

• All groups, and the users in each group. A group should appear even if there are no users assigned to the group.

• All rooms, and the groups assigned to each room. The rooms should appear even if no groups have been assigned to them.

• A list of users, the groups that they belong to, and the rooms to which they are assigned. This should be sorted alphabetically by user, then by group, then by room.

Solutions

Expert Solution

To manage this system, I have used 4 database tables names Users, Groups, Rooms, Access and created new fields UserId, GroupId and RoomId inorder to maintain the integrity of the data. Structure of these tables are as below:

The relationship between these entities are represented as below:

-------------------------------------

1. Creating the table Users:

CREATE TABLE Users(
UserID int NOT NULL,
    UserName varchar(50) NOT NULL,
    GroupID int,
    PRIMARY KEY (UserID), FOREIGN KEY (GroupId) REFERENCES Groups(GroupId) ); );

2. Creating the table Groups:

CREATE TABLE Groups(
GroupId int NOT NULL,
GroupName varchar(50) NOT NULL,
    PRIMARY KEY (GroupId) );

3. Creating the table Rooms:

CREATE TABLE Rooms(
RoomId int NOT NULL,
RoomName varchar(50) NOT NULL,
    PRIMARY KEY (RoomId) );

3. Creating the table Access:

CREATE TABLE Access(
GroupId int NOT NULL,
RoomId int NOT NULL, PRIMARY KEY (RoomId), FOREIGN KEY (RoomId) REFERENCES Rooms(RoomId), FOREIGN KEY (GroupId) REFERENCES Groups(GroupId) );

-------------------------------------------------------

Inserting data into Users table:

1. INSERT INTO Users  VALUES (1,' Modesto','1);

2. INSERT INTO Users  VALUES (2,' Ayine ',1);

3. INSERT INTO Users  VALUES (3,' Christopher',2);

4. INSERT INTO Users  VALUES (4,' Cheong',2);

5. INSERT INTO Users  VALUES (5,' Saulat',3);

6. INSERT INTO Users  VALUES (6,' Heidy', NULL);

Inserting data into Groups table:

1. INSERT INTO Groups VALUES (1,' I.T.' );

2. INSERT INTO Groups VALUES (2,' Sales' );

3. INSERT INTO Groups VALUES (3,' Administration' );

4. INSERT INTO Groups VALUES (4,' Operationes.' );

Inserting data into Rooms table:

1. INSERT INTO Rooms VALUES (1,'101' );

2. INSERT INTO Rooms VALUES (2,'102' );

3. INSERT INTO Rooms VALUES (3,' Auditorium A' );

4. INSERT INTO Rooms VALUES (4,' Auditorium B' );

Inserting data into Access table:

1. INSERT INTO Access VALUES (1,1);

2. INSERT INTO Access VALUES (1,2);

3. INSERT INTO Access VALUES (2,2);

4. INSERT INTO Access VALUES (2,3);

5. INSERT INTO Access VALUES (3,NULL);

-------------------------------------------------------------------------------------------------------

1. Select G.GroupId, G.GroupName, U.UserID from Groups G LEFT JOIN Users U on G.GroupId=U.GroupID;

2. Select R.RoomId, R.RoomName, A.GroupName from Rooms R LEFT JOIN Access A on R.RoomId=A.RoomsID;

3. Select U.UserID, U.UserName, R.RoomName, G.GroupName from User U LEFT JOIN Access on U.GRoupID=A.GroupID LEFT JOIN Rooms R on A.RoomID=R.RoomId order by U.UserName,G.GroupName,R.RoomName;

  


Related Solutions

explain please why you read an articles about relational database management system. why it is important...
explain please why you read an articles about relational database management system. why it is important to understand the characteristics of relational database management system?
What are some of the advantages of a relational database system?
What are some of the advantages of a relational database system?
Describe what a database system is and how it is used. What is a relational database...
Describe what a database system is and how it is used. What is a relational database system and how used in a company to benefit an organization? What does it mean to run a query?
Subject: Database Design System and Management We have been introduced to the concept of Relational databases,...
Subject: Database Design System and Management We have been introduced to the concept of Relational databases, SQL, Business rules, Centralized and Distributed database systems. Write 2/3 paragraph and discuss: Q: How important are Relational Debase Management System in business operations and productivity? What is your level of comfort with this technology? How important are Logical database design and what was your favorite topic.?   
The management of Acme Widgets has agreed that a relational database management system should be implemented to track its customer and order information.
Case Study: Taking the Plunge/ CIW: Database Design SpecialistThe management of Acme Widgets has agreed that a relational database management system should be implemented to track its customer and order information. Joe is now tasked with recommending a specific RDBMS.Joe conducts several interviews with management in order to put together a requirements document. He is able to ascertain the following:The preliminary budget is minimal.The preliminary schedule is tight (management wants the system in place as soon as possible).Company sales have...
Normalizing the Relational Model for the Student Project and Creating a Normalized SQL Database Patient (patientNo,...
Normalizing the Relational Model for the Student Project and Creating a Normalized SQL Database Patient (patientNo, name, address, phone, dateOfBirth, sex, insuranceCo, policyNo, relationshipToInsured) Appointment(patientNo, apptdate, appttime, reason, staffNo, visitNo) Visit(visitNo, patientNo, visitdate, visittime, duration, reason, visitType, visitCost, staffNo, roomNo) Staff(staffNo, name, title, specialty, address, phone) Availability(staffNo, availDate, startTime, endTime) InsurancePolicy (company, policyNo, insuredName, policytype, medicalCoPay, labCoPay, pharmacyCoPay, startDate, endingDate) DiagnosisMenu(diagCode, diagName) ProcedureMenu(procCode, procName, cost) Room(roomNo, roomType, condition) PrescriptionScript(scriptNo, visitNo, dateWritten, itemPrescribed, quantityPrescribed, directions, numberRefills) LabTest(testNo, prescriptionNo, testype, testDate, testTime,...
For this part, assume you are entering information about transactions into their relational database. You will...
For this part, assume you are entering information about transactions into their relational database. You will be entering financial information, but you will also need to consider the other types of information Big Marker would want to know about that event. You will also utilize what you have learned to identify internal controls specific to each transaction. The transactions are as follows: a. Billed 30 communities for monthly dues of $600 (each). b. Borrowed $10,000 from First National Bank with...
For the group project, you will be creating a database system to solve a business problem...
For the group project, you will be creating a database system to solve a business problem of your choice. The database system must meet the criteria shown below. In addition to the database solution, each student will prepare a system summary. Database System Requirements (Group Work): Create a database and name it ITCO630_GPx where "x" is your group letter. Populate your database with appropriate test data. Include all of the scripts in a single file called ITCO630_GPx.SQL where x is...
Design and implement a relational database application of your choice using MS Workbench on MySQL a)...
Design and implement a relational database application of your choice using MS Workbench on MySQL a) Declare two relations (tables) using the SQL DDL. To each relation name, add the last 4 digits of your Student-ID. Each relation (table) should have at least 4 attributes. Insert data to both relations (tables); (15%) b) Based on your expected use of the database, choose some of the attributes of each relation as your primary keys (indexes). To each Primary Key name, add...
tableA is a table in a relational database with a composite prime key. You have determined...
tableA is a table in a relational database with a composite prime key. You have determined that the table is 2NF. Owing to the fact that it is 2NF and the key is composite, is it automatically 3NF? Explain your answer. (4 points) Lack of normalization of database tables may cause update, delete, and/or insert anomalies. You have a 2NF table, tableA, in a relational database. Give an example of an anomaly to which tableA might still be subject. Give...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT