Description
Unformatted Attachment Preview
Purchase answer to see full attachment
Explanation & Answer
View attached explanation and answer. Let me know if you have any questions.
SQL Assignment
Name Omitted
14th November 2021
Entity Relationship Diagram
QUESTION ONE
CREATE DATABASE
CREATE DATABASE Blood_Bank;
CREATE TABLES
CREATE TABLE Donor
(DID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(25),
Email VARCHAR(30),
Gender VARCHAR(15),
PRIMARY KEY (DID)
);
CREATE TABLE Clinic
(CID INT NOT NULL AUTO_INCREMENT,
Name VARCHAR(25),
Location VARCHAR(30),
PRIMARY KEY (CID)
);
CREATE TABLE Blood
(BID INT NOT NULL AUTO_INCREMENT,
Type VARCHAR(25),
DID INT NOT NULL,
CID INT NOT NULL,
PRIMARY KEY (BID),
FOREIGN KEY (DID)
REFERENCES Donor(DID),
FOREIGN KEY (CID)
REFERENCES Clinic(CID)
);
SCREENSHOTS
QUESTION TWO
INSERT DATA
INSERT INTO Donor (Name, Email, Gender) VALUES ('Ronna', 'Ronna@gmail.com',
'Female');
INSERT INTO Donor (Name, Email, Gender) VALUES ('Ben', 'Ben@gmail.com', 'Male');
INSERT INTO Donor (Name, Email, Gender) VALUES ('Brenda', 'brenda@gmail.com',
'Female');
INSERT INTO Donor (Name, Email, Gender) VALUES ('Ron', 'Ron@gmail.com', 'Male');
INSERT INTO Donor (Name, Email, Gender) VALUES ('Austin', 'Austin@gmail.com', 'Male');
INSERT INTO Clinic (Name, Location) VALUES ('Maternity', 'New York');
INSERT INTO Clinic (Name, Location) VALUES ('Dental', 'New Jersey');
INSERT INTO Clinic (Name, Location) VALUES ('Ear and Throat', 'Los Angeles');
INSERT INTO Clinic (Name, Location) VALUES ('Eye', 'Washington DC');
INSERT INTO Clinic (Name, Location) VALUES ('Gynaecology', 'Chicago');
INSERT INTO Blood (Type, DID, CID) VALUES ('AB', 1,1);
INSERT INTO Blood (Type, DID, CID) VALUES ('A', 2,2);
INSERT INTO Blood (Type, DID, CID) VALUES ('B', 3,3);
INSERT INTO Blood (Type, DID, CID) VALUES ('O+', 4,4);
INSERT INTO Blood (Type, DID, CID) VALUES ('O-', 5,5);
SCREENSHOTS
SELECT * FROM Donor;
SELECT * FROM Clinic;
SELECT * FROM Blood;
SELECT d.name, b.type, c.name FROM Donor d INNER JOIN Blood b ON d.DID=b.DID
INNER JOIN Clinic c ON c.CID=b.CID;
QUESTION THREE
Correct code:
PHP Exercise
.error{
font-weight: bold;
color: #C00;
}
Assignment 1
Enter your first and last name
The first error identified is the first input type name which should be "name" and not
"Firstname".
The Font-wieght =22; is erroneous in the html and causes the lack of retrieval of name from
query string and storing to a local variable. It leads to the execution of the else statement that
returns $name to NULL.
The next error thrown is a call to an undefined function called method() that should be removed
to prevent the throwing of the exception.
QUESTION FOUR
The PHP code to connect the database is:
The php code in operation:
PHP Exercise
.error{
font-weight: bold;
color: #C00;
}
Donor Name
Blood Type
Clinic Name
Result
College of Computing and Informatics
E-Portals Development
IT-405
...