SlideShare a Scribd company logo
1 of 31
DESIGN DATABASE FOR THE ZOO
Amarpreet Kaur Dhanoa
Student ID: 0596307
Ramandeep Kaur Bagri
Student ID: 0597705
INTRODUCTION
❖ Project focus: Organizing the data in the zoo
❖ Primary purpose of designing database
Get the schedule for the Keepers
Track on the visitors
Locate the keepers on their schedule locations
Sending thank you note to visitors
Many other minor and major queries of the zoo management
ZOO DATABASE
❖ Planning of the collections of tuples (Curino, Michael n.d.);
❖ State (StateID, City, ZipCode)
❖ Zoo (ZooID, ZooName, ZooDesc)
❖ ZooVisitor (ZooVisitorID, ZooVisdate, ZooVisTime, ZooVisName,
ZooVisAddress)
Zoo Database continue...
❖ Animals (AnimalID, species, age, CageID)
❖ Cages (Cageid, Cagesize, CageLocation)
❖ Keepers (Keeperid, Name, Address)
❖ CareSchedule (CareScheduleID, CareTime, CareDate, AnimalID,
KeeperID)
❖ AdoptionCenter (AdoptionCenterID, ZooVisitorID, AnimalID)
ERD of Zoo Database
WHICH MONTH IS POPULAR FOR VISITORS?
SELECT MONTH (ZooVisDate),
count(1)
FROM
prjct_ZooVisitor
GROUP BY 1 ;
SHOW COMPLETE INFORMATION ZOO ADOPTERS
SELECT n.ZooVisName, n.ZooVisAddress, n.ZooVisDate, s.AdoptionDate
FROM prjct_ZooVisitor n
JOIN prjct_AdoptionCenter s WHERE n.ZooVisitorID = s.ZooVisitorID
WHICH ANIMAL IS POPULAR FOR ADOPTION?
SELECT prjct_AdoptionCenter.AnimalID,
COUNT(*), prjct_animal.AnimalSpecies
FROM
prjct_AdoptionCenter,
prjct_animal
WHERE
prjct_AdoptionCenter.AnimalID =
prjct_animal.AnimalID
group by 1, 3;
DISPLAY CARE SCHEDULE FOR ZIA QI
SELECT k.KeeperName, cs.AnimalID,
cs.CareTime, cs.CareDate, c.CareLocation
FROM prjct_keepers k, prjct_careSchedule
cs, prjct_cages c
WHERE k.KeeperID= "18" and cs.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID;
NOTE: There are more results, but not able to fit here
AnimalID = 34 =
Represents Livestock
HOW MANY ANIMALS NEED FEEDING AFTER 6AM?
SELECT DISTINCT AnimalSpecies , CareTime
FROM prjct_animal a, prjct_careSchedule c
WHERE a.AnimalID = c.AnimalID AND CareTime > '6:00AM'
DISPLAY SCHEDULE FOR SIA TY
SELECT k.KeeperName, cs.AnimalID,
cs.CareTime, cs.CareDate, c.CareLocation
FROM prjct_keepers k, prjct_careSchedule
cs, prjct_cages c
WHERE k.KeeperID= "19" and cs.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID ;
NOTE: There are more results, but not able to fit here
Animal ID = 35 = PUERTO
RICAN PARROT
SHOW THE COUNT OF KEEPERS TAKING CARE OF ANIMALS
AND THE TIME
SELECT count(5) as
NumberOfTimesKeeperTa
keCare,
KeeperName, CareTime
from prjct_careSchedule ,
prjct_keepers
WHERE
prjct_careSchedule.keepe
rID =
prjct_keepers.keeperID
GROUP BY 2,3
DISPLAY SCHEDULE FOR DIA SI
SELECT k.KeeperName, cs.AnimalID,
cs.CareTime, cs.CareDate,
c.CareLocation
FROM prjct_keepers k,
prjct_careSchedule cs, prjct_cages c
WHERE k.KeeperID= "20" and
cs.AnimalID = c.AnimalID and
cs.keeperID = k.keeperID;
NOTE: There are more results, but not able to fit here
Animal ID = 36 = Alligators
COUNT NUMBER OF VISITORS PER YEAR
SELECT
year(ZooVisDate),
count(1)
FROM prjct_ZooVisitor
GROUP by 1;
DISPLAY SCHEDULE FOR KIA QI
SELECT k.KeeperName,
a.AnimalSpecies,
cs.CareTime, cs.CareDate,
c.CareLocation
FROM prjct_keepers k,
prjct_careSchedule cs,
prjct_cages c,
prjct_animal a
WHERE k.KeeperID= "22" and a.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID
NOTE: There are more results, but not able to fit here
Animal ID = 38 = Australian Sea Lion
DISPLAY NAMES OF THE ANIMAL SPECIES, CARE TIME AND
KEEPER NAME
SELECT DISTINCT a.AnimalSpecies,
cs.CareTime, c.
CareLocation,
k.KeeperName
FROM prjct_animal a,
prjct_careSchedule cs,
prjct_cages c, prjct_keepers k
WHERE a.AnimalID =
cs.AnimalID and
cs.AnimalID = c.AnimalID
and cs.keeperID=k.keeperID
SHOW ADOPTIONS PER YEAR
SELECT year (AdoptionDate),
count(1)
FROM prjct_AdoptionCenter
GROUP BY 1
DISPLAY SCHEDULE FOR HIA RU
SELECT k.KeeperName, cs.AnimalID,
cs.CareTime, cs.CareDate, c.CareLocation
FROM prjct_keepers k, prjct_careSchedule cs,
prjct_cages c
WHERE k.KeeperID= "21" and cs.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID;
NOTE: There are more results, but not able to fit here
Animal ID = 37 = Pythonidae
DISPLAY ANIMAL SPECIES WITH
KEEPER NAME AND THEIR CARE YEAR
SELECT distinct k.KeeperName,
a.AnimalSpecies,
YEAR(c.CareDate) AS careYear
From prjct_careSchedule c,
prjct_keepers k, prjct_animal a
WHERE a.AnimalID= c.AnimalID
and c.keeperID = k.keeperID;
NOTE: There are more results, but not able to fit here
DISPLAY POPULAR MONTH FOR ADOPTION
SELECT month (AdoptionDate), count(1)
FROM prjct_AdoptionCenter
group by 1
DISPLAY SCHEDULE FOR WIA CI
SELECT k.KeeperName, cs.AnimalID, cs.CareTime,
cs.CareDate, c.CareLocation
FROM prjct_keepers k, prjct_careSchedule cs,
prjct_cages c
WHERE k.KeeperID= "23" and cs.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID LIMIT 0,
100 ;
NOTE: There are more results, but not able to fit here
Animal ID = 39 = Chinese Alligators
WHICH MONTH IS POPULAR FOR VISITORS?
SELECT MONTH (ZooVisDate), count(1)
FROM prjct_ZooVisitor
GROUP by 1
DISPLAY SCHEDULE FOR QIA YU
SELECT k.KeeperName, cs.AnimalID, cs.CareTime,
cs.CareDate, c.CareLocation
FROM prjct_keepers k, prjct_careSchedule cs,
prjct_cages c
WHERE k.KeeperID= "24" and cs.AnimalID =
c.AnimalID and cs.keeperID = k.keeperID LIMIT 0, 25
;
NOTE: There are more results, but not able to fit here
Animal ID = 40 =Monotremes
DISPLAY COUNT OF
WORKING OF EACH
KEEPER IN EACH
YEAR?
SELECT year(CareDate), keeperName,
count(*)
FROM prjct_careSchedule, prjct_keepers
WHERE prjct_careSchedule.keeperID =
prjct_keepers.keeperID group by 1,2;
NOTE: There are more results, but not able to fit here
DISPLAY NUMBER OF DATES OF CARE EACH YEAR
SELECT year (CareDate), count(1)
FROM prjct_careSchedule
GROUP BY 1
DISPLAY KEEPER
NAME , ANIMAL
SPECIES IN EACH
YEAR
SELECT distinct k.KeeperName,
a.AnimalSpecies, YEAR(c.CareDate)
AS careYear
FROM prjct_careSchedule c,
prjct_keepers k, prjct_animal a
WHERE a.AnimalID =
c.AnimalID and c.keeperID =
k.keeperID
NOTE: There are more results,
but not able to fit here
COUNT ADOPTION CENTERS PER LOCATION
SELECT LocationDesc, count(1)
FROM prjct_location
GROUP BY 1;
DISPLAY SCHEDULE FOR KEEPER AIA MU
SELECT k.KeeperName,
cs.AnimalID, cs.CareTime,
cs.CareDate, c.CareLocation
FROM prjct_keepers k,
prjct_careSchedule cs, prjct_cages
c
WHERE k.KeeperID= "17" and
cs.AnimalID = c.AnimalID and
cs.keeperID = k.keeperID
NOTE: There are more results, but not able to fit here
Animal ID = 33 =
Black Bulls
DISPLAY THANK YOU MESSGAE TO VISITORS
SELECT ZooVisAddress,
CONCAT( ' To Dear ‘,
ZooVisName,
' thank you for visiting the Zoo.
‘)
AS Visitor_Text
FROM rbagri.prjct_ZooVisitor
NOTE: There are more results,
but not able to fit here
Reference
C. Curino, S. Michael. (n.d.). Database Systems.
MITOPENCOURSEWARE-home-courses- electrical engineering and
Computer Science- Database Systems-Lecture Notes-The relational
Model(pdf). Retrieved from https://ocw.mit.edu/courses/electrical-
engineering-and-computer-science/6-830- database-systems-fall-
2010/lecture-notes/
SELECT ("Thank you for your attention") as " Thankyou Note”

More Related Content

What's hot (20)

SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Restaurant Management System Database Project (Oracle)
Restaurant Management System Database Project (Oracle)Restaurant Management System Database Project (Oracle)
Restaurant Management System Database Project (Oracle)
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Queue Management System
Queue Management SystemQueue Management System
Queue Management System
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 4 Structured Query Language
Chapter 4 Structured Query LanguageChapter 4 Structured Query Language
Chapter 4 Structured Query Language
 
Online food ordering system
Online food ordering systemOnline food ordering system
Online food ordering system
 
ER diagram for Shopping Mall Management System
ER diagram for Shopping Mall Management SystemER diagram for Shopping Mall Management System
ER diagram for Shopping Mall Management System
 
Database Security And Authentication
Database Security And AuthenticationDatabase Security And Authentication
Database Security And Authentication
 
Database
DatabaseDatabase
Database
 
SRS Attendance ERP
SRS Attendance ERPSRS Attendance ERP
SRS Attendance ERP
 
Sql commands
Sql commandsSql commands
Sql commands
 
Mysql Ppt
Mysql PptMysql Ppt
Mysql Ppt
 
Hospital management system dfd
Hospital management system dfdHospital management system dfd
Hospital management system dfd
 
Sql join
Sql  joinSql  join
Sql join
 
data manipulation language
data manipulation languagedata manipulation language
data manipulation language
 
Online courseregistration tolstoy
Online courseregistration   tolstoyOnline courseregistration   tolstoy
Online courseregistration tolstoy
 
Data dictionary
Data dictionaryData dictionary
Data dictionary
 

Recently uploaded

如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证zifhagzkk
 
What is Insertion Sort. Its basic information
What is Insertion Sort. Its basic informationWhat is Insertion Sort. Its basic information
What is Insertion Sort. Its basic informationmuqadasqasim10
 
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeBoston Institute of Analytics
 
edited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfedited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfgreat91
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...ThinkInnovation
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"John Sobanski
 
How to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsHow to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsBrainSell Technologies
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfRobertoOcampo24
 
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxAudience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxStephen266013
 
Displacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second DerivativesDisplacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second Derivatives23050636
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...ThinkInnovation
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjadimosmejiaslendon
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证acoha1
 
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di Ban...
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di  Ban...obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di  Ban...
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di Ban...siskavia95
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单aqpto5bt
 
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI  MANAJEMEN OF PENYAKIT TETANUS.pptMATERI  MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI MANAJEMEN OF PENYAKIT TETANUS.pptRachmaGhifari
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证pwgnohujw
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...yulianti213969
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样jk0tkvfv
 
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...ssuserf63bd7
 

Recently uploaded (20)

如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
如何办理(Dalhousie毕业证书)达尔豪斯大学毕业证成绩单留信学历认证
 
What is Insertion Sort. Its basic information
What is Insertion Sort. Its basic informationWhat is Insertion Sort. Its basic information
What is Insertion Sort. Its basic information
 
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital AgeCredit Card Fraud Detection: Safeguarding Transactions in the Digital Age
Credit Card Fraud Detection: Safeguarding Transactions in the Digital Age
 
edited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfedited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdf
 
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
Identify Customer Segments to Create Customer Offers for Each Segment - Appli...
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
 
How to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsHow to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data Analytics
 
Formulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdfFormulas dax para power bI de microsoft.pdf
Formulas dax para power bI de microsoft.pdf
 
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxAudience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptx
 
Displacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second DerivativesDisplacement, Velocity, Acceleration, and Second Derivatives
Displacement, Velocity, Acceleration, and Second Derivatives
 
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
Identify Rules that Predict Patient’s Heart Disease - An Application of Decis...
 
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarjSCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
SCI8-Q4-MOD11.pdfwrwujrrjfaajerjrajrrarj
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di Ban...
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di  Ban...obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di  Ban...
obat aborsi Banjarmasin wa 082135199655 jual obat aborsi cytotec asli di Ban...
 
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
一比一原版(ucla文凭证书)加州大学洛杉矶分校毕业证学历认证官方成绩单
 
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI  MANAJEMEN OF PENYAKIT TETANUS.pptMATERI  MANAJEMEN OF PENYAKIT TETANUS.ppt
MATERI MANAJEMEN OF PENYAKIT TETANUS.ppt
 
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
原件一样(UWO毕业证书)西安大略大学毕业证成绩单留信学历认证
 
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
obat aborsi Tarakan wa 081336238223 jual obat aborsi cytotec asli di Tarakan9...
 
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
如何办理(UCLA毕业证书)加州大学洛杉矶分校毕业证成绩单学位证留信学历认证原件一样
 
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
Statistics Informed Decisions Using Data 5th edition by Michael Sullivan solu...
 

Sql project final_slides

  • 1. DESIGN DATABASE FOR THE ZOO Amarpreet Kaur Dhanoa Student ID: 0596307 Ramandeep Kaur Bagri Student ID: 0597705
  • 2. INTRODUCTION ❖ Project focus: Organizing the data in the zoo ❖ Primary purpose of designing database Get the schedule for the Keepers Track on the visitors Locate the keepers on their schedule locations Sending thank you note to visitors Many other minor and major queries of the zoo management
  • 3. ZOO DATABASE ❖ Planning of the collections of tuples (Curino, Michael n.d.); ❖ State (StateID, City, ZipCode) ❖ Zoo (ZooID, ZooName, ZooDesc) ❖ ZooVisitor (ZooVisitorID, ZooVisdate, ZooVisTime, ZooVisName, ZooVisAddress)
  • 4. Zoo Database continue... ❖ Animals (AnimalID, species, age, CageID) ❖ Cages (Cageid, Cagesize, CageLocation) ❖ Keepers (Keeperid, Name, Address) ❖ CareSchedule (CareScheduleID, CareTime, CareDate, AnimalID, KeeperID) ❖ AdoptionCenter (AdoptionCenterID, ZooVisitorID, AnimalID)
  • 5. ERD of Zoo Database
  • 6. WHICH MONTH IS POPULAR FOR VISITORS? SELECT MONTH (ZooVisDate), count(1) FROM prjct_ZooVisitor GROUP BY 1 ;
  • 7. SHOW COMPLETE INFORMATION ZOO ADOPTERS SELECT n.ZooVisName, n.ZooVisAddress, n.ZooVisDate, s.AdoptionDate FROM prjct_ZooVisitor n JOIN prjct_AdoptionCenter s WHERE n.ZooVisitorID = s.ZooVisitorID
  • 8. WHICH ANIMAL IS POPULAR FOR ADOPTION? SELECT prjct_AdoptionCenter.AnimalID, COUNT(*), prjct_animal.AnimalSpecies FROM prjct_AdoptionCenter, prjct_animal WHERE prjct_AdoptionCenter.AnimalID = prjct_animal.AnimalID group by 1, 3;
  • 9. DISPLAY CARE SCHEDULE FOR ZIA QI SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "18" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID; NOTE: There are more results, but not able to fit here AnimalID = 34 = Represents Livestock
  • 10. HOW MANY ANIMALS NEED FEEDING AFTER 6AM? SELECT DISTINCT AnimalSpecies , CareTime FROM prjct_animal a, prjct_careSchedule c WHERE a.AnimalID = c.AnimalID AND CareTime > '6:00AM'
  • 11. DISPLAY SCHEDULE FOR SIA TY SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "19" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID ; NOTE: There are more results, but not able to fit here Animal ID = 35 = PUERTO RICAN PARROT
  • 12. SHOW THE COUNT OF KEEPERS TAKING CARE OF ANIMALS AND THE TIME SELECT count(5) as NumberOfTimesKeeperTa keCare, KeeperName, CareTime from prjct_careSchedule , prjct_keepers WHERE prjct_careSchedule.keepe rID = prjct_keepers.keeperID GROUP BY 2,3
  • 13. DISPLAY SCHEDULE FOR DIA SI SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "20" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID; NOTE: There are more results, but not able to fit here Animal ID = 36 = Alligators
  • 14. COUNT NUMBER OF VISITORS PER YEAR SELECT year(ZooVisDate), count(1) FROM prjct_ZooVisitor GROUP by 1;
  • 15. DISPLAY SCHEDULE FOR KIA QI SELECT k.KeeperName, a.AnimalSpecies, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c, prjct_animal a WHERE k.KeeperID= "22" and a.AnimalID = c.AnimalID and cs.keeperID = k.keeperID NOTE: There are more results, but not able to fit here Animal ID = 38 = Australian Sea Lion
  • 16. DISPLAY NAMES OF THE ANIMAL SPECIES, CARE TIME AND KEEPER NAME SELECT DISTINCT a.AnimalSpecies, cs.CareTime, c. CareLocation, k.KeeperName FROM prjct_animal a, prjct_careSchedule cs, prjct_cages c, prjct_keepers k WHERE a.AnimalID = cs.AnimalID and cs.AnimalID = c.AnimalID and cs.keeperID=k.keeperID
  • 17. SHOW ADOPTIONS PER YEAR SELECT year (AdoptionDate), count(1) FROM prjct_AdoptionCenter GROUP BY 1
  • 18. DISPLAY SCHEDULE FOR HIA RU SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "21" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID; NOTE: There are more results, but not able to fit here Animal ID = 37 = Pythonidae
  • 19. DISPLAY ANIMAL SPECIES WITH KEEPER NAME AND THEIR CARE YEAR SELECT distinct k.KeeperName, a.AnimalSpecies, YEAR(c.CareDate) AS careYear From prjct_careSchedule c, prjct_keepers k, prjct_animal a WHERE a.AnimalID= c.AnimalID and c.keeperID = k.keeperID; NOTE: There are more results, but not able to fit here
  • 20. DISPLAY POPULAR MONTH FOR ADOPTION SELECT month (AdoptionDate), count(1) FROM prjct_AdoptionCenter group by 1
  • 21. DISPLAY SCHEDULE FOR WIA CI SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "23" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID LIMIT 0, 100 ; NOTE: There are more results, but not able to fit here Animal ID = 39 = Chinese Alligators
  • 22. WHICH MONTH IS POPULAR FOR VISITORS? SELECT MONTH (ZooVisDate), count(1) FROM prjct_ZooVisitor GROUP by 1
  • 23. DISPLAY SCHEDULE FOR QIA YU SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "24" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID LIMIT 0, 25 ; NOTE: There are more results, but not able to fit here Animal ID = 40 =Monotremes
  • 24. DISPLAY COUNT OF WORKING OF EACH KEEPER IN EACH YEAR? SELECT year(CareDate), keeperName, count(*) FROM prjct_careSchedule, prjct_keepers WHERE prjct_careSchedule.keeperID = prjct_keepers.keeperID group by 1,2; NOTE: There are more results, but not able to fit here
  • 25. DISPLAY NUMBER OF DATES OF CARE EACH YEAR SELECT year (CareDate), count(1) FROM prjct_careSchedule GROUP BY 1
  • 26. DISPLAY KEEPER NAME , ANIMAL SPECIES IN EACH YEAR SELECT distinct k.KeeperName, a.AnimalSpecies, YEAR(c.CareDate) AS careYear FROM prjct_careSchedule c, prjct_keepers k, prjct_animal a WHERE a.AnimalID = c.AnimalID and c.keeperID = k.keeperID NOTE: There are more results, but not able to fit here
  • 27. COUNT ADOPTION CENTERS PER LOCATION SELECT LocationDesc, count(1) FROM prjct_location GROUP BY 1;
  • 28. DISPLAY SCHEDULE FOR KEEPER AIA MU SELECT k.KeeperName, cs.AnimalID, cs.CareTime, cs.CareDate, c.CareLocation FROM prjct_keepers k, prjct_careSchedule cs, prjct_cages c WHERE k.KeeperID= "17" and cs.AnimalID = c.AnimalID and cs.keeperID = k.keeperID NOTE: There are more results, but not able to fit here Animal ID = 33 = Black Bulls
  • 29. DISPLAY THANK YOU MESSGAE TO VISITORS SELECT ZooVisAddress, CONCAT( ' To Dear ‘, ZooVisName, ' thank you for visiting the Zoo. ‘) AS Visitor_Text FROM rbagri.prjct_ZooVisitor NOTE: There are more results, but not able to fit here
  • 30. Reference C. Curino, S. Michael. (n.d.). Database Systems. MITOPENCOURSEWARE-home-courses- electrical engineering and Computer Science- Database Systems-Lecture Notes-The relational Model(pdf). Retrieved from https://ocw.mit.edu/courses/electrical- engineering-and-computer-science/6-830- database-systems-fall- 2010/lecture-notes/
  • 31. SELECT ("Thank you for your attention") as " Thankyou Note”