View the step-by-step solution to:

CREATE DATABASE Blood CREATE TABLE Blood.Patients ( FirstName VARCHAR(20), LastName VARCHAR(30), PatID VARCHAR(10), PatBloodGroup VARCHAR(2),...

I need some help with a database project I am working on:

 Write the Add/Change/Delete Routines

Write the programs that will allow you to add a record, change a record, and delete a record for each of the tables in your database.

Done in MySQL

I have created a database which is a blood donation system. I have three tables which is data of patient, data of donar, and the data of blood banks. I need to write a procedure that will allow for data to be added, changed, or deleted for each table. I am having issues developing a procedure for each table where i can call the procedure and change the data. So i need help with the procedures. Here is my data which is done in MySQL Workbench:


CREATE DATABASE Blood

CREATE TABLE Blood.Patients
(
FirstName VARCHAR(20),
LastName VARCHAR(30),
PatID VARCHAR(10),
PatBloodGroup VARCHAR(2),
PAddress VARCHAR(30),
PPhone VARCHAR(11)
);

INSERT INTO Blood.Patients values ('John','Doe','01','A','1234 E. Regular St.','4805551234');
INSERT INTO Blood.Patients values ('Jane','Doe','02','B','1234 E. Regular St.','4805551235');
INSERT INTO Blood.Patients values ('Max','Powers','03','AB','555 E. Makers St.','4805555678');
INSERT INTO Blood.Patients values ('Alex','Moran','04','O','678 N. Manning Way','4805556789');
INSERT INTO Blood.Patients values ('Thad','Castle','05','A','789 W. Elway Cir.','4805553456');
INSERT INTO Blood.Patients values ('Justin','Smith','06','B','890 S. Gallo St.','4805558901');
INSERT INTO Blood.Patients values ('Sarah','Nicks','07','AB','234 E. Helton Dr.','4805552345');
INSERT INTO Blood.Patients values ('Dawn','Sanders','08','O','345 N. Gonzalez St.','4805554567');
INSERT INTO Blood.Patients values ('Ed','Thomas','09','A','456 E. Nowhere St.','4805557890');
INSERT INTO Blood.Patients values ('Lindsay','Matthers','10','B','567 E. Elm St.','4805554739');


CREATE TABLE Blood.Donors
(
DFirstName VARCHAR(20),
DLastName VARCHAR(30),
DonID VARCHAR(10),
DonBloodGroup VARCHAR(2),
DAddress VARCHAR(30),
DPhone VARCHAR(11)
);


INSERT INTO Blood.Donors values ('Noah','Johnson','01','A','5670 Wilshire Blvd','4805551230');
INSERT INTO Blood.Donors values ('Liam','Brown','02','B','8001 Irvine Center Dr.','4805551231');
INSERT INTO Blood.Donors values ('Jacob','Jones','03','AB','4660 La Jolla Village Dr.','4805555672');
INSERT INTO Blood.Donors values ('William','Miller','04','O','576 Hawthorne Ave.','4805556783');
INSERT INTO Blood.Donors values ('Michael','Garcia','05','A','600 Anton Boulevard','4805553454');
INSERT INTO Blood.Donors values ('Emma','Rodriqeuz','06','B','890 N. LaSalle St.','4805558905');
INSERT INTO Blood.Donors values ('Olivia','Anderson','07','AB','350 N. 10th Ave.','4805552346');
INSERT INTO Blood.Donors values ('Sophia','Moore','08','O','840 N. Gateway Dr.','4805554567');
INSERT INTO Blood.Donors values ('Isabella','Jackson','09','A','411 E. Lafayette St.','4805557891');
INSERT INTO Blood.Donors values ('Emily','Lopez','10','B','201 W. 17th St.','4805554738');


CREATE TABLE Blood.BloodBank
(
BankName VARCHAR(20),
BankAddress VARCHAR(30),
BankPhone VARCHAR(11)
);


INSERT INTO Blood.BloodBank values ('United BloodServices','1989 W. Elliot Rd.','8778274376');
INSERT INTO Blood.BloodBank values ('Blood Systems','1337 S. Gilbert Rd.','4806321416');
INSERT INTO Blood.BloodBank values ('Biomat USA','535 S. Dobson Rd.','4808331598');
INSERT INTO Blood.BloodBank values ('CSL Plasma','711 N. Gilbert Rd.','6022185097');
INSERT INTO Blood.BloodBank values ('Blood Center','123 E. Bonfire Way','4805555555');
INSERT INTO Blood.BloodBank values ('UBS','234 N. Blade Ave.','4805551659');
INSERT INTO Blood.BloodBank values ('ARC','456 S. Vampire St.','4805556666');
INSERT INTO Blood.BloodBank values ('Blood Alliance','789 E. Red Cir.','4805551597');
INSERT INTO Blood.BloodBank values ('OneBlood','234 E. Plasma Dr.','4805459261');
INSERT INTO Blood.BloodBank values ('LifeSource','810 N. Dracula St.','4805558971');

CREATE DATABASE Blood CREATE TABLE Blood.Patients ( FirstName VARCHAR(20), LastName VARCHAR(30), PatID VARCHAR(10), PatBloodGroup VARCHAR(2), PAddress VARCHAR(30), PPhone VARCHAR(11) ); INSERT INTO Blood.Patients values ('John','Doe','01','A','1234 E. Regular St.','4805551234'); INSERT INTO Blood.Patients values ('Jane','Doe','02','B','1234 E. Regular St.','4805551235'); INSERT INTO Blood.Patients values ('Max','Powers','03','AB','555 E. Makers St.','4805555678'); INSERT INTO Blood.Patients values ('Alex','Moran','04','O','678 N. Manning Way','4805556789'); INSERT INTO Blood.Patients values ('Thad','Castle','05','A','789 W. Elway Cir.','4805553456'); INSERT INTO Blood.Patients values ('Justin','Smith','06','B','890 S. Gallo St.','4805558901'); INSERT INTO Blood.Patients values ('Sarah','Nicks','07','AB','234 E. Helton Dr.','4805552345'); INSERT INTO Blood.Patients values ('Dawn','Sanders','08','O','345 N. Gonzalez St.','4805554567'); INSERT INTO Blood.Patients values ('Ed','Thomas','09','A','456 E. Nowhere St.','4805557890'); INSERT INTO Blood.Patients values ('Lindsay','Matthers','10','B','567 E. Elm St.','4805554739'); CREATE TABLE Blood.Donors ( DFirstName VARCHAR(20), DLastName VARCHAR(30), DonID VARCHAR(10), DonBloodGroup VARCHAR(2), DAddress VARCHAR(30), DPhone VARCHAR(11) ); INSERT INTO Blood.Donors values ('Noah','Johnson','01','A','5670 Wilshire Blvd','4805551230'); INSERT INTO Blood.Donors values ('Liam','Brown','02','B','8001 Irvine Center Dr.','4805551231'); INSERT INTO Blood.Donors values ('Jacob','Jones','03','AB','4660 La Jolla Village Dr.','4805555672'); INSERT INTO Blood.Donors values ('William','Miller','04','O','576 Hawthorne Ave.','4805556783'); INSERT INTO Blood.Donors values ('Michael','Garcia','05','A','600 Anton Boulevard','4805553454'); INSERT INTO Blood.Donors values ('Emma','Rodriqeuz','06','B','890 N. LaSalle St.','4805558905'); INSERT INTO Blood.Donors values ('Olivia','Anderson','07','AB','350 N. 10th Ave.','4805552346'); INSERT INTO Blood.Donors values ('Sophia','Moore','08','O','840 N. Gateway Dr.','4805554567'); INSERT INTO Blood.Donors values ('Isabella','Jackson','09','A','411 E. Lafayette St.','4805557891'); INSERT INTO Blood.Donors values ('Emily','Lopez','10','B','201 W. 17th
Background image of page 1
St.','4805554738'); CREATE TABLE Blood.BloodBank ( BankName VARCHAR(20), BankAddress VARCHAR(30), BankPhone VARCHAR(11) ); INSERT INTO Blood.BloodBank values ('United BloodServices','1989 W. Elliot Rd.','8778274376'); INSERT INTO Blood.BloodBank values ('Blood Systems','1337 S. Gilbert Rd.','4806321416'); INSERT INTO Blood.BloodBank values ('Biomat USA','535 S. Dobson Rd.','4808331598'); INSERT INTO Blood.BloodBank values ('CSL Plasma','711 N. Gilbert Rd.','6022185097'); INSERT INTO Blood.BloodBank values ('Blood Center','123 E. Bonfire Way','4805555555'); INSERT INTO Blood.BloodBank values ('UBS','234 N. Blade Ave.','4805551659'); INSERT INTO Blood.BloodBank values ('ARC','456 S. Vampire St.','4805556666'); INSERT INTO Blood.BloodBank values ('Blood Alliance','789 E. Red Cir.','4805551597'); INSERT INTO Blood.BloodBank values ('OneBlood','234 E. Plasma Dr.','4805459261'); INSERT INTO Blood.BloodBank values ('LifeSource','810 N. Dracula St.','4805558971'); SELECT * FROM Blood.Patients SELECT * FROM Blood.Donors SELECT * FROM Blood.BloodBank
Background image of page 2
Sign up to view the entire interaction

Top Answer

Please see the attached... View the full answer

procedures.sql

/*
Procedure insert Data
Insert the value parameter and the table while
use select to view the results from the table */
DELIMITER //
CREATE PROCEDURE insert_data (IN my_values VARCHAR(20), IN...

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online