SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
ITCS 3160 Database Design and Implementation
mySQL Report
Tanguy Bousole-Tamsi
Yasser Meza
Sylvester Mensah
7th December 2016
Dr. Pamela Thompson
T.A Venkata Vaishnavi
The purpose of this report is to show the implementation of a database that
stores the extracurricular activities of undergraduate students. The report also shows
the creation of specific reports for college departments and sponsors.
Business Rules:
-Person will be any student/faculty/staff
-Student can have only one faculty advisor
-An Event can have only one sponsor(Person)
-A Person can sponsor zero to many events
-Students can sign up to one or many events
-Events can have one to many students
-All Events require Evaluation form from Students that asks
 Was the event useful? 1-5
 Would you recommend to another student? 1-5
 Was the event relative to your major? 1-5
-Faculty need a report listing the advisees(Students) and the Events they attended.
-Sponsors need report of individual event and average of ratings.
-Students need to list Events they have registered for and attended.
EERD
SQL Statements:
A- Create For each table:
CREATE TABLE `evaluation` (
`Person_Person_ID` int(11) NOT NULL,
`Event_Event_ID` varchar(45) DEFAULT NULL,
`Useful` int(11) DEFAULT NULL,
`Recommend` int(11) DEFAULT NULL,
`MajorRelated` int(11) DEFAULT NULL,
`Person_Person_ID1` int(11) NOT NULL,
`Events_Event_ID` int(11) NOT NULL,
`Events_Person_Person_ID` int(11) NOT NULL,
`Events_Event_ID1` int(11) NOT NULL,
`Events_Person_Person_ID1` int(11) NOT NULL,
PRIMARY KEY
(`Person_Person_ID`,`Person_Person_ID1`,`Events_Event_ID`,`Events_Person_Person_ID`,`E
vents_Event_ID1`,`Events_Person_Person_ID1`),
KEY `fk_Evaluation_Person1_idx` (`Person_Person_ID1`),
KEY `fk_Evaluation_Events1_idx` (`Events_Event_ID1`,`Events_Person_Person_ID1`),
CONSTRAINT `fk_Evaluation_Events1` FOREIGN KEY (`Events_Event_ID1`,
`Events_Person_Person_ID1`) REFERENCES `events` (`Event_ID`, `Person_Person_ID`) ON
DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Evaluation_Person1` FOREIGN KEY (`Person_Person_ID1`)
REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `department` (
`Dept_ID` int(11) NOT NULL AUTO_INCREMENT,
`Dept_Name` varchar(45) DEFAULT NULL,
PRIMARY KEY (`Dept_ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `events` (
`Event_ID` int(11) NOT NULL AUTO_INCREMENT,
`Name` varchar(45) DEFAULT NULL, `Description` varchar(45) DEFAULT NULL,
`Date/Time` datetime DEFAULT NULL, `length` int(11) DEFAULT NULL,
`Location` varchar(45) DEFAULT NULL, `Sponsor_ID` int(11) DEFAULT NULL,
`Person_Person_ID` int(11) NOT NULL, PRIMARY KEY (`Event_ID`,`Person_Person_ID`),
KEY `fk_Events_Person1_idx` (`Person_Person_ID`), CONSTRAINT `fk_Events_Person1`
FOREIGN KEY (`Person_Person_ID`) REFERENCES `person` (`Person_ID`) ON DELETE NO
ACTION ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `faculty` (
`Highest_Degree` varchar(45) DEFAULT NULL,
`Hire_Year` datetime DEFAULT NULL,
`Person_Person_ID` int(11) DEFAULT NULL,
`Person_Person_ID1` int(11) NOT NULL,
PRIMARY KEY (`Person_Person_ID1`),
CONSTRAINT `fk_Faculty_Person1` FOREIGN KEY (`Person_Person_ID1`) REFERENCES
`person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `person` (
`Person_ID` int(11) NOT NULL AUTO_INCREMENT,
`Fname` varchar(45) DEFAULT NULL, `MInt` varchar(45) DEFAULT NULL,
`Address` varchar(45) DEFAULT NULL, `City` varchar(45) DEFAULT NULL,
`State` varchar(45) DEFAULT NULL, `Phone` int(11) DEFAULT NULL,
`zip` int(11) DEFAULT NULL, `email` varchar(45) DEFAULT NULL,
`Department_Dept_ID` int(11) DEFAULT NULL, `Department_Dept_ID1` int(11) NOT NULL,
PRIMARY KEY (`Person_ID`), KEY `fk_Person_Department1_idx` (`Department_Dept_ID1`),
CONSTRAINT `fk_Person_Department1` FOREIGN KEY (`Department_Dept_ID1`)
REFERENCES `department` (`Dept_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `staff` (
`Pos_Title` varchar(45) DEFAULT NULL, `SupervisorYorN` tinyint(1) DEFAULT NULL,
`Person_Person_ID` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL,
PRIMARY KEY (`Person_Person_ID1`), CONSTRAINT `fk_Staff_Person1` FOREIGN KEY
(`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON
UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `student` (
`Major_ID` int(11) DEFAULT NULL, `SAT_Score` double DEFAULT NULL,
`HS_GPA` double DEFAULT NULL, `On_Campus_YorN` tinyint(1) DEFAULT NULL,
`Person_Person_ID` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL,
PRIMARY KEY (`Person_Person_ID1`), CONSTRAINT `fk_Student_Person1` FOREIGN KEY
(`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON
UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `studentevents` (
`Person_Person_ID` int(11) NOT NULL, `Event_Event_ID` int(11) NOT NULL,
`StudentRegistration` varchar(45) DEFAULT NULL, `Student_Person_Person_ID1` int(11)
NOT NULL, `Evaluation_Person_Person_ID` int(11) NOT NULL,
`Evaluation_Person_Person_ID1` int(11) NOT NULL,
`Evaluation_Events_Event_ID` int(11) NOT NULL,
`Evaluation_Events_Person_Person_ID` int(11) NOT NULL,
PRIMARY KEY
(`Person_Person_ID`,`Event_Event_ID`,`Student_Person_Person_ID1`,`Evaluation_Person_Pe
rson_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_ID`,`Evaluation_Events_
Person_Person_ID`),
KEY `fk_StudentEvents_Student1_idx` (`Student_Person_Person_ID1`),
KEY `fk_StudentEvents_Evaluation1_idx`
(`Evaluation_Person_Person_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_
ID`,`Evaluation_Events_Person_Person_ID`),
CONSTRAINT `fk_StudentEvents_Evaluation1` FOREIGN KEY
(`Evaluation_Person_Person_ID`, `Evaluation_Person_Person_ID1`,
`Evaluation_Events_Event_ID`, `Evaluation_Events_Person_Person_ID`) REFERENCES
`evaluation` (`Person_Person_ID`, `Person_Person_ID1`, `Events_Event_ID`,
`Events_Person_Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_StudentEvents_Student1` FOREIGN KEY (`Student_Person_Person_ID1`)
REFERENCES `student` (`Person_Person_ID1`) ON DELETE NO ACTION ON UPDATE NO
ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
B- Insert For each table:
INSERT INTO department(Dept_ID, Dept_Name) VALUES (2, 'Medecine');
INSERT INTO `mydb`.`staff` (`Pos_Title`, `SupervisorYorN`, `Person_Person_ID`,
`Person_Person_ID1`) VALUES ('Advisor', 'Y', '2', '2');
INSERT INTO `evaluation` (`Person_Person_ID`, `Event_Event_ID`, `Useful`, `Recommend`,
`MajorRelated`, `Person_Person_ID1`, `Events_Event_ID`, `Events_Person_Person_ID`,
`Events_Event_ID1`, `Events_Person_Person_ID1`) VALUES ('1', '2', '4', '3', 'yes', '1', '2', '1', '1',
'1');
INSERT INTO `mydb`.`events`
(`Event_ID`, `Name`, `Description`, `Date/Time`, `length`, `Location`,
`Sponsor_ID`, `Person_Person_ID`) VALUES (<{Event_ID: }>, <{Name: }>, <{Description: }>,
<{Date/Time: }>, <{length: }>, <{Location: }>, <{Sponsor_ID: }>, <{Person_Person_ID: }>);
INSERT INTO `mydb`.`faculty` (`Highest_Degree`, `Hire_Year`, `Person_Person_ID`,
`Person_Person_ID1`) VALUES ('Master', '200-8-7 3:12:00', '5', '5');VALUES
(<{Highest_Degree: }>, <{Hire_Year: }>, <{Person_Person_ID: }>, <{Person_Person_ID1: }>);
INSERT INTO `mydb`.`person`
(`Person_ID`,
`Fname`,`MInt`,`Address`,`City`,`State`,`Phone`,`zip`,`email`,`Department_Dept_ID`,
`Department_Dept_ID1`)
VALUES(<{Person_ID: }>,<{Fname: }>,<{MInt: }>,<{Address: }>,<{City: }>,<{State: }>,
<{Phone: }>,<{zip: }>,<{email: }>,<{Department_Dept_ID: }>,<{Department_Dept_ID1: }>);
INSERT INTO `mydb`.`staff`
(`Pos_Title`,`SupervisorYorN`,`Person_Person_ID`,`Person_Person_ID1`)
VALUES(<{Pos_Title: }>,<{SupervisorYorN: }>,<{Person_Person_ID: }>,<{Person_Person_ID1:
}>);
INSERT INTO `mydb`.`student` (`Major_ID`, `SAT_Score`, `HS_GPA`, `On_Campus_YorN`,
`Person_Person_ID`, `Person_Person_ID1`) VALUES ('1', '56', '87', 'y', '2', '2');
INSERT INTO `mydb`.`studentevents`
(`Person_Person_ID`,`Event_Event_ID`,`StudentRegistration`,`Student_Person_Person_ID1`,
`Evaluation_Person_Person_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_I
D`,`Evaluation_Events_Person_Person_ID`)VALUES (<{Person_Person_ID: }>,
<{Event_Event_ID: }>,<{StudentRegistration: }>, <{Student_Person_Person_ID1: }>,
<{Evaluation_Person_Person_ID: }>,<{Evaluation_Person_Person_ID1: }>,
<{Evaluation_Events_Event_ID: }>,<{Evaluation_Events_Person_Person_ID: }>);
Stored Procedure
CREATE PROCEDURE Get_Events()
BEGIN select * FROM events; END
Trigger
CREATE TABLE Department_Update(
Dept_ID INT AUTO_INCREMENT PRIMARY KEY,
Dept_Name VARCHAR(45) DEFAULT NULL
);
CREATE TRIGGER `Department_Update` BEFORE UPDATE ON `department` FOR EACH
ROW INSERT INTO department_update SET Dept_Name = 'update', Dept_ID = OLD.Dept_ID;
Example of Delete and Update For One Table:
A. Delete
DELETE FROM `person` WHERE `person`.`Person_ID` = 6
B. Update
UPDATE `mydb`.`events` SET `Date/Time`='13142012 00:00:00' WHERE `Event_ID`='1'
and`Person_Person_ID`='1';
SQL For The Views of Four Reports
1- Faculty need to receive a report listing their advisees and events that the advisees attended
CREATE ALGORITHM = UNDEFINED VIEW `EventAdvisees` AS SELECT `person`.`Fname`,
`events`.`Name` FROM `person` LEFT JOIN `events` ON `events`.`Person_Person_ID` =
`person`.`Person_ID`
2- Sponsors need to receive a report of an individual event and the average of the ratings
SELECT `events`.`Name`, `evaluation`.`Useful`, `evaluation`.`Recommend`
FROM `events`
LEFT JOIN `evaluation` ON `evaluation`.`Events_Event_ID1` = `events`.`Event_ID` AND
`evaluation`.`Events_Person_Person_ID1` = `events`.`Person_Person_ID`
3- Students need to be able to list the events of a particular type
4- Person needs to list all faculty with their highest degree
SELECT `person`.`Fname`, `person`.`MInt`, `faculty`.`Highest_Degree` FROM `person` LEFT
JOIN `faculty` ON `faculty`.`Person_Person_ID1` = `person`.`Person_ID` ORDER BY `Fname`
ASC
Transaction
BEGIN;
INSERT INTO department(Dept_ID, Dept_Name) VALUES(10, ‘Dept_Transaction’);
COMMIT;
INDEXES
CREATE INDEX FNameIndex ON Person(Fname);
SELECT Fname from person;
SELECT Fname from person ORDER BY `Fname` ASC
CREATE INDEX `fk_Person_Department1_idx` ON `mydb`.`person` (`Department_Dept_ID1`
ASC);
CREATE INDEX `fk_Events_Person1_idx` ON `mydb`.`events` (`Person_Person_ID` ASC);
CREATE INDEX `fk_Evaluation_Person1_idx` ON `mydb`.`evaluation` (`Person_Person_ID1`
ASC);
CREATE INDEX `fk_StudentEvents_Student1_idx` ON `mydb`.`studentevents`
(`Student_Person_Person_ID1` ASC);

Contenu connexe

En vedette

Semiotica de la arquitectura
Semiotica de la arquitecturaSemiotica de la arquitectura
Semiotica de la arquitecturadanieladcatoni
 
Hung Phan Resume 1Dec16
Hung Phan Resume 1Dec16Hung Phan Resume 1Dec16
Hung Phan Resume 1Dec16Hung Phan
 
Hunting With Louis Sullivan: Metaphysics, Color Theory and Life
Hunting With Louis Sullivan: Metaphysics, Color Theory and LifeHunting With Louis Sullivan: Metaphysics, Color Theory and Life
Hunting With Louis Sullivan: Metaphysics, Color Theory and LifeVicki Milewski
 
Franz et al tdwg 2016 introducing lep net
Franz et al tdwg 2016 introducing lep netFranz et al tdwg 2016 introducing lep net
Franz et al tdwg 2016 introducing lep nettaxonbytes
 
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agvErasmus University Medical Center
 
Sostenibilidad y ciuda
Sostenibilidad y ciudaSostenibilidad y ciuda
Sostenibilidad y ciudaestela rojo
 
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...1vivianalozano
 
Making new moves in education&learning
Making new moves in education&learningMaking new moves in education&learning
Making new moves in education&learningAusteja Zvaginyte
 
Preguntas gene-3-encu-ana-escri
Preguntas gene-3-encu-ana-escriPreguntas gene-3-encu-ana-escri
Preguntas gene-3-encu-ana-escriDiego Solano
 
Tallersena 110222182130-phpapp02
Tallersena 110222182130-phpapp02Tallersena 110222182130-phpapp02
Tallersena 110222182130-phpapp02degenerada
 
CKLAM Recommendation-LawrenceWSChan2016Career
CKLAM Recommendation-LawrenceWSChan2016CareerCKLAM Recommendation-LawrenceWSChan2016Career
CKLAM Recommendation-LawrenceWSChan2016CareerLaurent WS Chan 陈唯诚
 

En vedette (16)

Semiotica de la arquitectura
Semiotica de la arquitecturaSemiotica de la arquitectura
Semiotica de la arquitectura
 
Delitos informaticos
Delitos informaticosDelitos informaticos
Delitos informaticos
 
Hung Phan Resume 1Dec16
Hung Phan Resume 1Dec16Hung Phan Resume 1Dec16
Hung Phan Resume 1Dec16
 
Hunting With Louis Sullivan: Metaphysics, Color Theory and Life
Hunting With Louis Sullivan: Metaphysics, Color Theory and LifeHunting With Louis Sullivan: Metaphysics, Color Theory and Life
Hunting With Louis Sullivan: Metaphysics, Color Theory and Life
 
Franz et al tdwg 2016 introducing lep net
Franz et al tdwg 2016 introducing lep netFranz et al tdwg 2016 introducing lep net
Franz et al tdwg 2016 introducing lep net
 
Power @@la+antá..
Power @@la+antá..Power @@la+antá..
Power @@la+antá..
 
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv
2016 11 17 aaps_337 denver vulto biosimilars interchangeability vs16k16agv
 
Sostenibilidad y ciuda
Sostenibilidad y ciudaSostenibilidad y ciuda
Sostenibilidad y ciuda
 
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...
21010100904 preparar los pedidos aplicando los diferentes metodos de extracci...
 
Making new moves in education&learning
Making new moves in education&learningMaking new moves in education&learning
Making new moves in education&learning
 
Preguntas gene-3-encu-ana-escri
Preguntas gene-3-encu-ana-escriPreguntas gene-3-encu-ana-escri
Preguntas gene-3-encu-ana-escri
 
Fundraise 101
Fundraise 101Fundraise 101
Fundraise 101
 
Dale don dale
Dale don daleDale don dale
Dale don dale
 
Tallersena 110222182130-phpapp02
Tallersena 110222182130-phpapp02Tallersena 110222182130-phpapp02
Tallersena 110222182130-phpapp02
 
1 en subir
1 en subir1 en subir
1 en subir
 
CKLAM Recommendation-LawrenceWSChan2016Career
CKLAM Recommendation-LawrenceWSChan2016CareerCKLAM Recommendation-LawrenceWSChan2016Career
CKLAM Recommendation-LawrenceWSChan2016Career
 

Similaire à ExtracurricularReady

Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Sanchit Raut
 
IFESFinal58
IFESFinal58IFESFinal58
IFESFinal58anish h
 
Dataiku - Paris JUG 2013 - Hadoop is a batch
Dataiku - Paris JUG 2013 - Hadoop is a batch Dataiku - Paris JUG 2013 - Hadoop is a batch
Dataiku - Paris JUG 2013 - Hadoop is a batch Dataiku
 
Data infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesData infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesMartin Loetzsch
 
The accidental web designer - No Code Conf 2019 Workshop
The accidental web designer - No Code Conf 2019 WorkshopThe accidental web designer - No Code Conf 2019 Workshop
The accidental web designer - No Code Conf 2019 WorkshopWebflow
 
Don't Repeat Yourself, and Automated Code Reviews
Don't Repeat Yourself, and Automated Code ReviewsDon't Repeat Yourself, and Automated Code Reviews
Don't Repeat Yourself, and Automated Code ReviewsGramener
 
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Dan Robinson
 
Youth Tobacco Survey Analysis
Youth Tobacco Survey AnalysisYouth Tobacco Survey Analysis
Youth Tobacco Survey AnalysisRoshik Ganesan
 
Nunes database
Nunes databaseNunes database
Nunes databaseRohini17
 
computer science investigatory project .pdf
computer science investigatory project .pdfcomputer science investigatory project .pdf
computer science investigatory project .pdfAryanNaglot
 
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFs
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFsAutomating Predictive Modeling at Zynga with PySpark and Pandas UDFs
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFsDatabricks
 
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...MongoDB
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
On SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdfOn SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdfinfomalad
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeWim Godden
 
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docx
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docxPage 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docx
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docxalfred4lewis58146
 
A2 databases
A2 databasesA2 databases
A2 databasesc.west
 
Historical Finance Data
Historical Finance DataHistorical Finance Data
Historical Finance DataJEE HYUN PARK
 
PythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみたPythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみたitoxdev
 
Project_2CIS405(GroupProject)
Project_2CIS405(GroupProject)Project_2CIS405(GroupProject)
Project_2CIS405(GroupProject)James Wu
 

Similaire à ExtracurricularReady (20)

Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.Miniproject on Employee Management using Perl/Database.
Miniproject on Employee Management using Perl/Database.
 
IFESFinal58
IFESFinal58IFESFinal58
IFESFinal58
 
Dataiku - Paris JUG 2013 - Hadoop is a batch
Dataiku - Paris JUG 2013 - Hadoop is a batch Dataiku - Paris JUG 2013 - Hadoop is a batch
Dataiku - Paris JUG 2013 - Hadoop is a batch
 
Data infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companiesData infrastructure for the other 90% of companies
Data infrastructure for the other 90% of companies
 
The accidental web designer - No Code Conf 2019 Workshop
The accidental web designer - No Code Conf 2019 WorkshopThe accidental web designer - No Code Conf 2019 Workshop
The accidental web designer - No Code Conf 2019 Workshop
 
Don't Repeat Yourself, and Automated Code Reviews
Don't Repeat Yourself, and Automated Code ReviewsDon't Repeat Yourself, and Automated Code Reviews
Don't Repeat Yourself, and Automated Code Reviews
 
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
Powering Heap With PostgreSQL And CitusDB (PGConf Silicon Valley 2015)
 
Youth Tobacco Survey Analysis
Youth Tobacco Survey AnalysisYouth Tobacco Survey Analysis
Youth Tobacco Survey Analysis
 
Nunes database
Nunes databaseNunes database
Nunes database
 
computer science investigatory project .pdf
computer science investigatory project .pdfcomputer science investigatory project .pdf
computer science investigatory project .pdf
 
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFs
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFsAutomating Predictive Modeling at Zynga with PySpark and Pandas UDFs
Automating Predictive Modeling at Zynga with PySpark and Pandas UDFs
 
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...
MongoDB Days Silicon Valley: From Story to Document: Applying MongoDB Thinkin...
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
On SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdfOn SQL Managment studioThis lab is all about database normalizatio.pdf
On SQL Managment studioThis lab is all about database normalizatio.pdf
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docx
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docxPage 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docx
Page 1 of 27 Tony LoCoco ITCO333 – Unit 2 August 2.docx
 
A2 databases
A2 databasesA2 databases
A2 databases
 
Historical Finance Data
Historical Finance DataHistorical Finance Data
Historical Finance Data
 
PythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみたPythonでJWT生成からボット作成、投稿までやってみた
PythonでJWT生成からボット作成、投稿までやってみた
 
Project_2CIS405(GroupProject)
Project_2CIS405(GroupProject)Project_2CIS405(GroupProject)
Project_2CIS405(GroupProject)
 

ExtracurricularReady

  • 1. ITCS 3160 Database Design and Implementation mySQL Report Tanguy Bousole-Tamsi Yasser Meza Sylvester Mensah 7th December 2016 Dr. Pamela Thompson T.A Venkata Vaishnavi The purpose of this report is to show the implementation of a database that stores the extracurricular activities of undergraduate students. The report also shows the creation of specific reports for college departments and sponsors. Business Rules: -Person will be any student/faculty/staff -Student can have only one faculty advisor -An Event can have only one sponsor(Person) -A Person can sponsor zero to many events -Students can sign up to one or many events -Events can have one to many students -All Events require Evaluation form from Students that asks  Was the event useful? 1-5  Would you recommend to another student? 1-5  Was the event relative to your major? 1-5 -Faculty need a report listing the advisees(Students) and the Events they attended. -Sponsors need report of individual event and average of ratings.
  • 2. -Students need to list Events they have registered for and attended. EERD SQL Statements: A- Create For each table: CREATE TABLE `evaluation` ( `Person_Person_ID` int(11) NOT NULL, `Event_Event_ID` varchar(45) DEFAULT NULL, `Useful` int(11) DEFAULT NULL, `Recommend` int(11) DEFAULT NULL, `MajorRelated` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL, `Events_Event_ID` int(11) NOT NULL, `Events_Person_Person_ID` int(11) NOT NULL, `Events_Event_ID1` int(11) NOT NULL, `Events_Person_Person_ID1` int(11) NOT NULL, PRIMARY KEY (`Person_Person_ID`,`Person_Person_ID1`,`Events_Event_ID`,`Events_Person_Person_ID`,`E vents_Event_ID1`,`Events_Person_Person_ID1`), KEY `fk_Evaluation_Person1_idx` (`Person_Person_ID1`), KEY `fk_Evaluation_Events1_idx` (`Events_Event_ID1`,`Events_Person_Person_ID1`), CONSTRAINT `fk_Evaluation_Events1` FOREIGN KEY (`Events_Event_ID1`, `Events_Person_Person_ID1`) REFERENCES `events` (`Event_ID`, `Person_Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  • 3. CONSTRAINT `fk_Evaluation_Person1` FOREIGN KEY (`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `department` ( `Dept_ID` int(11) NOT NULL AUTO_INCREMENT, `Dept_Name` varchar(45) DEFAULT NULL, PRIMARY KEY (`Dept_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `events` ( `Event_ID` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(45) DEFAULT NULL, `Description` varchar(45) DEFAULT NULL, `Date/Time` datetime DEFAULT NULL, `length` int(11) DEFAULT NULL, `Location` varchar(45) DEFAULT NULL, `Sponsor_ID` int(11) DEFAULT NULL, `Person_Person_ID` int(11) NOT NULL, PRIMARY KEY (`Event_ID`,`Person_Person_ID`), KEY `fk_Events_Person1_idx` (`Person_Person_ID`), CONSTRAINT `fk_Events_Person1` FOREIGN KEY (`Person_Person_ID`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `faculty` ( `Highest_Degree` varchar(45) DEFAULT NULL, `Hire_Year` datetime DEFAULT NULL, `Person_Person_ID` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL, PRIMARY KEY (`Person_Person_ID1`), CONSTRAINT `fk_Faculty_Person1` FOREIGN KEY (`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `person` ( `Person_ID` int(11) NOT NULL AUTO_INCREMENT, `Fname` varchar(45) DEFAULT NULL, `MInt` varchar(45) DEFAULT NULL, `Address` varchar(45) DEFAULT NULL, `City` varchar(45) DEFAULT NULL, `State` varchar(45) DEFAULT NULL, `Phone` int(11) DEFAULT NULL, `zip` int(11) DEFAULT NULL, `email` varchar(45) DEFAULT NULL, `Department_Dept_ID` int(11) DEFAULT NULL, `Department_Dept_ID1` int(11) NOT NULL, PRIMARY KEY (`Person_ID`), KEY `fk_Person_Department1_idx` (`Department_Dept_ID1`), CONSTRAINT `fk_Person_Department1` FOREIGN KEY (`Department_Dept_ID1`) REFERENCES `department` (`Dept_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `staff` ( `Pos_Title` varchar(45) DEFAULT NULL, `SupervisorYorN` tinyint(1) DEFAULT NULL, `Person_Person_ID` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL, PRIMARY KEY (`Person_Person_ID1`), CONSTRAINT `fk_Staff_Person1` FOREIGN KEY (`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `student` (
  • 4. `Major_ID` int(11) DEFAULT NULL, `SAT_Score` double DEFAULT NULL, `HS_GPA` double DEFAULT NULL, `On_Campus_YorN` tinyint(1) DEFAULT NULL, `Person_Person_ID` int(11) DEFAULT NULL, `Person_Person_ID1` int(11) NOT NULL, PRIMARY KEY (`Person_Person_ID1`), CONSTRAINT `fk_Student_Person1` FOREIGN KEY (`Person_Person_ID1`) REFERENCES `person` (`Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE `studentevents` ( `Person_Person_ID` int(11) NOT NULL, `Event_Event_ID` int(11) NOT NULL, `StudentRegistration` varchar(45) DEFAULT NULL, `Student_Person_Person_ID1` int(11) NOT NULL, `Evaluation_Person_Person_ID` int(11) NOT NULL, `Evaluation_Person_Person_ID1` int(11) NOT NULL, `Evaluation_Events_Event_ID` int(11) NOT NULL, `Evaluation_Events_Person_Person_ID` int(11) NOT NULL, PRIMARY KEY (`Person_Person_ID`,`Event_Event_ID`,`Student_Person_Person_ID1`,`Evaluation_Person_Pe rson_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_ID`,`Evaluation_Events_ Person_Person_ID`), KEY `fk_StudentEvents_Student1_idx` (`Student_Person_Person_ID1`), KEY `fk_StudentEvents_Evaluation1_idx` (`Evaluation_Person_Person_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_ ID`,`Evaluation_Events_Person_Person_ID`), CONSTRAINT `fk_StudentEvents_Evaluation1` FOREIGN KEY (`Evaluation_Person_Person_ID`, `Evaluation_Person_Person_ID1`, `Evaluation_Events_Event_ID`, `Evaluation_Events_Person_Person_ID`) REFERENCES `evaluation` (`Person_Person_ID`, `Person_Person_ID1`, `Events_Event_ID`, `Events_Person_Person_ID`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `fk_StudentEvents_Student1` FOREIGN KEY (`Student_Person_Person_ID1`) REFERENCES `student` (`Person_Person_ID1`) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB DEFAULT CHARSET=utf8; B- Insert For each table: INSERT INTO department(Dept_ID, Dept_Name) VALUES (2, 'Medecine'); INSERT INTO `mydb`.`staff` (`Pos_Title`, `SupervisorYorN`, `Person_Person_ID`, `Person_Person_ID1`) VALUES ('Advisor', 'Y', '2', '2'); INSERT INTO `evaluation` (`Person_Person_ID`, `Event_Event_ID`, `Useful`, `Recommend`, `MajorRelated`, `Person_Person_ID1`, `Events_Event_ID`, `Events_Person_Person_ID`, `Events_Event_ID1`, `Events_Person_Person_ID1`) VALUES ('1', '2', '4', '3', 'yes', '1', '2', '1', '1', '1'); INSERT INTO `mydb`.`events` (`Event_ID`, `Name`, `Description`, `Date/Time`, `length`, `Location`, `Sponsor_ID`, `Person_Person_ID`) VALUES (<{Event_ID: }>, <{Name: }>, <{Description: }>, <{Date/Time: }>, <{length: }>, <{Location: }>, <{Sponsor_ID: }>, <{Person_Person_ID: }>);
  • 5. INSERT INTO `mydb`.`faculty` (`Highest_Degree`, `Hire_Year`, `Person_Person_ID`, `Person_Person_ID1`) VALUES ('Master', '200-8-7 3:12:00', '5', '5');VALUES (<{Highest_Degree: }>, <{Hire_Year: }>, <{Person_Person_ID: }>, <{Person_Person_ID1: }>); INSERT INTO `mydb`.`person` (`Person_ID`, `Fname`,`MInt`,`Address`,`City`,`State`,`Phone`,`zip`,`email`,`Department_Dept_ID`, `Department_Dept_ID1`) VALUES(<{Person_ID: }>,<{Fname: }>,<{MInt: }>,<{Address: }>,<{City: }>,<{State: }>, <{Phone: }>,<{zip: }>,<{email: }>,<{Department_Dept_ID: }>,<{Department_Dept_ID1: }>); INSERT INTO `mydb`.`staff` (`Pos_Title`,`SupervisorYorN`,`Person_Person_ID`,`Person_Person_ID1`) VALUES(<{Pos_Title: }>,<{SupervisorYorN: }>,<{Person_Person_ID: }>,<{Person_Person_ID1: }>); INSERT INTO `mydb`.`student` (`Major_ID`, `SAT_Score`, `HS_GPA`, `On_Campus_YorN`, `Person_Person_ID`, `Person_Person_ID1`) VALUES ('1', '56', '87', 'y', '2', '2'); INSERT INTO `mydb`.`studentevents` (`Person_Person_ID`,`Event_Event_ID`,`StudentRegistration`,`Student_Person_Person_ID1`, `Evaluation_Person_Person_ID`,`Evaluation_Person_Person_ID1`,`Evaluation_Events_Event_I D`,`Evaluation_Events_Person_Person_ID`)VALUES (<{Person_Person_ID: }>, <{Event_Event_ID: }>,<{StudentRegistration: }>, <{Student_Person_Person_ID1: }>, <{Evaluation_Person_Person_ID: }>,<{Evaluation_Person_Person_ID1: }>, <{Evaluation_Events_Event_ID: }>,<{Evaluation_Events_Person_Person_ID: }>); Stored Procedure CREATE PROCEDURE Get_Events() BEGIN select * FROM events; END
  • 6. Trigger CREATE TABLE Department_Update( Dept_ID INT AUTO_INCREMENT PRIMARY KEY, Dept_Name VARCHAR(45) DEFAULT NULL ); CREATE TRIGGER `Department_Update` BEFORE UPDATE ON `department` FOR EACH ROW INSERT INTO department_update SET Dept_Name = 'update', Dept_ID = OLD.Dept_ID;
  • 7. Example of Delete and Update For One Table: A. Delete DELETE FROM `person` WHERE `person`.`Person_ID` = 6 B. Update UPDATE `mydb`.`events` SET `Date/Time`='13142012 00:00:00' WHERE `Event_ID`='1' and`Person_Person_ID`='1'; SQL For The Views of Four Reports 1- Faculty need to receive a report listing their advisees and events that the advisees attended
  • 8. CREATE ALGORITHM = UNDEFINED VIEW `EventAdvisees` AS SELECT `person`.`Fname`, `events`.`Name` FROM `person` LEFT JOIN `events` ON `events`.`Person_Person_ID` = `person`.`Person_ID` 2- Sponsors need to receive a report of an individual event and the average of the ratings SELECT `events`.`Name`, `evaluation`.`Useful`, `evaluation`.`Recommend` FROM `events` LEFT JOIN `evaluation` ON `evaluation`.`Events_Event_ID1` = `events`.`Event_ID` AND `evaluation`.`Events_Person_Person_ID1` = `events`.`Person_Person_ID`
  • 9. 3- Students need to be able to list the events of a particular type 4- Person needs to list all faculty with their highest degree SELECT `person`.`Fname`, `person`.`MInt`, `faculty`.`Highest_Degree` FROM `person` LEFT JOIN `faculty` ON `faculty`.`Person_Person_ID1` = `person`.`Person_ID` ORDER BY `Fname` ASC
  • 10. Transaction BEGIN; INSERT INTO department(Dept_ID, Dept_Name) VALUES(10, ‘Dept_Transaction’); COMMIT;
  • 11. INDEXES CREATE INDEX FNameIndex ON Person(Fname); SELECT Fname from person; SELECT Fname from person ORDER BY `Fname` ASC CREATE INDEX `fk_Person_Department1_idx` ON `mydb`.`person` (`Department_Dept_ID1` ASC); CREATE INDEX `fk_Events_Person1_idx` ON `mydb`.`events` (`Person_Person_ID` ASC); CREATE INDEX `fk_Evaluation_Person1_idx` ON `mydb`.`evaluation` (`Person_Person_ID1` ASC); CREATE INDEX `fk_StudentEvents_Student1_idx` ON `mydb`.`studentevents` (`Student_Person_Person_ID1` ASC);