SlideShare a Scribd company logo
1 of 30
Download to read offline
Database Management
With POSTGRESQL
Nhi Nguyen & Nathaly Gonzalez
OUR Student Leader
Nathaly Gonzalez
2
FUNNY. ENERGETIC. POSITIVE. LEADER. QUEEN
That’s
me!
OUR AGENDA
1. Introduction
● PostgreSQL & PgAdmin
● Relational Database
Management
2. Workshop Guideline
● Our main phases
● SQL functions and
statements
3. Resources for Self-Learning
3
✖ A free and open-source relational
database management system
emphasizing extensibility and
technical standards compliance.
✖ It is designed to handle a range of
workloads, from single machines to
data warehouses or Web services
with many concurrent users.
WHAT IS POSTGRESQL?
4
WHAT IS PgAdmin?
5
✖ A management tool for
PostgreSQL
✖ A graphical user interface that
we can use to easily interact
with our PostgreSQL server and
our databases.
✖ It may be run either as a web or
desktop application.
Our THREE MAIN PHASES
CREATE AND
IMPORT A
DATABASE
6
CONTROL
DATABASE
IMPROVE
DATABASE
1.
CREATE A DATABASE
Let’s start by converting our Excel
Spreadsheet to a CSV File
7
8
1. Download two CSV files in TD Workshop 1
Folder
2. Use the Guideline to add the CSV files to
correct folder
3. Insert into PostgreSQL using the given
queries
1. Creating Database
2. Creating Student Form table
9
Create food truck table
✖ Attributes:
○ foodtruck_id
○ foodtruck_name
○ address
○ zipcode
○ description
○ phone
○ open_hour
10
2.
CONTROL AND MANIPULATE
DATABASE
Let’s learn some SQL functions, shall we?
11
Querying data
✖ SELECT
✖ SELECT DISTINCT
12
✖ SELECT * FROM student_form
✖ SELECT DISTINCT food_truck
FROM student_form
filtering data
✖ WHERE
✖ LIMIT
✖ OFFSET & FETCH
13
✖ BETWEEN
✖ IS NULL
✖ LIKE
Practice round
✖ What is the name of all of the seniors participating in the
workshop? (Hint: WHERE)
✖ What are the top five study places? (Hint: LIMIT)
✖ Select the 6th to the 10th food trucks in the list (Hint:
FETCH & OFFSET)
✖ Which students spend between 5 to 8 hours to study?
(Hint: BETWEEN)
✖ Which food trucks do not have a phone number? How
many of them are there? (Hint: IS NULL)
14
Practice round
✖ Which food trucks do not have a phone number OR do
not have open hours? (Hint:IS NULL)
✖ Which food trucks do not have both a phone number
AND open hours? (Hint: IS NULL)
✖ Which food trucks start with the letter ‘T’? (Hint:
LIKE)
✖ Which food trucks end with the letter ‘a’? (Hint: LIKE)
✖ Which food trucks have ‘o’ in any position? (Hint:
LIKE)
15
Grouping data
✖ GROUP BY
✖ HAVING
✖ ORDER BY - ASC and DESC
16
Practice round
✖ How many students are tea people/coffee lovers and
have an online class this semester? (Hint: GROUP BY)
✖ How many international students in each year? (Hint:
GROUP BY)
✖ How many juniors have TTH class? (Hint: GROUP BY)
17
Practice round
✖ How many students study less than 10 hours? (Hint:
HAVING)
✖ Which year has the least amount of students? (Hint:
ORDER BY)
✖ Which year has the most amount of students? (Hint:
ORDER BY)
18
Aggregate functions
✖ AVG() and ROUND(X,2)
✖ COUNT()
✖ MAX()
✖ MIN()
✖ SUM()
19
Practice round
✖ Which year studies the most hours, on
average? (Hint: AVG())
✖ What is the rounded average hour that
students spend studying and using social
media? (Hint: ROUND())
✖ How many students are in each year? (Hint:
COUNT())
20
Practice round
✖ How many students are sophomores? (Hint:
COUNT())
✖ What is the maximum hour spent studying
from each class? (Hint: MAX())
✖ What is the minimum hour spent on social
media from each year? (Hint: MIN())
21
alias
✖ AS - Column alias
22
✖ SELECT first_name || ‘ ’ || last_name
AS full_name, class_rank
FROM student_form;
3.
IMPROVE DATABASE
Why not make it more robust and
detailed?
23
JOINING TABLES
✖ LEFT-JOIN
✖ SELF-JOIN
24
Practice round
✖ Join the description and open_hours
columns from food_truck table to the
student_form table (choose 3 columns
first_name, study_place, and food_truck)
(Hint: LEFT-JOIN)
25
Edit Values
✖ UPDATE …. SET
✖ INSERT INTO ….. VALUES
✖ DELETE FROM
✖ ALTER TABLE …. DROP COLUMN
26
Practice round
✖ Look at rows 25, 44, and 48, do you notice any
differences? (Hint: UPDATE….SET…)
✖ Nhi hasn’t filled in the form, add her information
in! (Hint: INSERT INTO … VALUES…)
✖ Delete Nhi’s values from the table (Hint: DELETE
FROM)
✖ Drop column zipcode from the food_truck table
(Hint: ALTER TABLE … DROP COLUMN)
27
LEARNING RESOURCES
Aka extra homework/exercises?
28
LEARNING RESOURCES
✖ PostgreSQL 11 in 7 days
✖ PostgreSQL Basic Functions
✖ PostgreSQl practice exercises and tutorial
29
AIS Attendance & Feedback FORM
bit.ly/TD1SAT
30
Exit code: Bunny
SUITABLE
POINTS

More Related Content

Similar to AIS Technical Development Workshop 1

TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptxTITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
TArmy1
 
PGNA 2014: Middle School
PGNA 2014: Middle SchoolPGNA 2014: Middle School
PGNA 2014: Middle School
Laura Jacob
 
SMS, Q&A, Course Evaluation tools in Sakai
SMS, Q&A, Course Evaluation tools in SakaiSMS, Q&A, Course Evaluation tools in Sakai
SMS, Q&A, Course Evaluation tools in Sakai
Stephen Marquard
 
Widening the reflection using OpenSyllabus and Core Sakai 2.6
Widening the reflection using OpenSyllabus and Core Sakai 2.6Widening the reflection using OpenSyllabus and Core Sakai 2.6
Widening the reflection using OpenSyllabus and Core Sakai 2.6
Olivier Guillot
 

Similar to AIS Technical Development Workshop 1 (20)

Certifiably Tableau Presentation
Certifiably Tableau PresentationCertifiably Tableau Presentation
Certifiably Tableau Presentation
 
TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptxTITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
TITLE_OF_THE_PROJECT_School_Management_S by SS gupta743.pptx
 
Development of a learning diary for a MOOC platform
Development of a learning diary for a MOOC platformDevelopment of a learning diary for a MOOC platform
Development of a learning diary for a MOOC platform
 
Using Large-Scale LMS Data Portal Data to Improve Teaching and Learning (at K...
Using Large-Scale LMS Data Portal Data to Improve Teaching and Learning (at K...Using Large-Scale LMS Data Portal Data to Improve Teaching and Learning (at K...
Using Large-Scale LMS Data Portal Data to Improve Teaching and Learning (at K...
 
The Guzman Monthly, March 2015, v2 i3
The Guzman Monthly, March 2015, v2 i3The Guzman Monthly, March 2015, v2 i3
The Guzman Monthly, March 2015, v2 i3
 
Cse202
Cse202Cse202
Cse202
 
PGNA 2014: Middle School
PGNA 2014: Middle SchoolPGNA 2014: Middle School
PGNA 2014: Middle School
 
minor project pr.pptx
minor project pr.pptxminor project pr.pptx
minor project pr.pptx
 
Creating Accessible Documents
Creating Accessible DocumentsCreating Accessible Documents
Creating Accessible Documents
 
SMS, Q&A, Course Evaluation tools in Sakai
SMS, Q&A, Course Evaluation tools in SakaiSMS, Q&A, Course Evaluation tools in Sakai
SMS, Q&A, Course Evaluation tools in Sakai
 
SMS, Q&A and Course Evaluations in Sakai
SMS, Q&A and Course Evaluations in SakaiSMS, Q&A and Course Evaluations in Sakai
SMS, Q&A and Course Evaluations in Sakai
 
Book store automation system
Book store automation systemBook store automation system
Book store automation system
 
Using Analytics to Intervene with Underperforming College Students
Using Analytics to Intervene with Underperforming College StudentsUsing Analytics to Intervene with Underperforming College Students
Using Analytics to Intervene with Underperforming College Students
 
The Guzman Monthly, August 2015, v2 i8
The Guzman Monthly, August 2015, v2 i8The Guzman Monthly, August 2015, v2 i8
The Guzman Monthly, August 2015, v2 i8
 
Widening the reflection using OpenSyllabus and Core Sakai 2.6
Widening the reflection using OpenSyllabus and Core Sakai 2.6Widening the reflection using OpenSyllabus and Core Sakai 2.6
Widening the reflection using OpenSyllabus and Core Sakai 2.6
 
Cincinnati Tableau User Group Event #1
Cincinnati Tableau User Group Event #1Cincinnati Tableau User Group Event #1
Cincinnati Tableau User Group Event #1
 
Agl forum november 2015 league tables
Agl forum november 2015 league tablesAgl forum november 2015 league tables
Agl forum november 2015 league tables
 
Fail Early or Fail Large - WPCampus - July 2019
Fail Early or Fail Large - WPCampus - July 2019Fail Early or Fail Large - WPCampus - July 2019
Fail Early or Fail Large - WPCampus - July 2019
 
Appropriate media for given learning session
Appropriate media for given learning sessionAppropriate media for given learning session
Appropriate media for given learning session
 
Implementing analytics - Myles Danson, Shri Footring, David Matthews, James F...
Implementing analytics - Myles Danson, Shri Footring, David Matthews, James F...Implementing analytics - Myles Danson, Shri Footring, David Matthews, James F...
Implementing analytics - Myles Danson, Shri Footring, David Matthews, James F...
 

Recently uploaded

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

AIS Technical Development Workshop 1

  • 1. Database Management With POSTGRESQL Nhi Nguyen & Nathaly Gonzalez
  • 2. OUR Student Leader Nathaly Gonzalez 2 FUNNY. ENERGETIC. POSITIVE. LEADER. QUEEN That’s me!
  • 3. OUR AGENDA 1. Introduction ● PostgreSQL & PgAdmin ● Relational Database Management 2. Workshop Guideline ● Our main phases ● SQL functions and statements 3. Resources for Self-Learning 3
  • 4. ✖ A free and open-source relational database management system emphasizing extensibility and technical standards compliance. ✖ It is designed to handle a range of workloads, from single machines to data warehouses or Web services with many concurrent users. WHAT IS POSTGRESQL? 4
  • 5. WHAT IS PgAdmin? 5 ✖ A management tool for PostgreSQL ✖ A graphical user interface that we can use to easily interact with our PostgreSQL server and our databases. ✖ It may be run either as a web or desktop application.
  • 6. Our THREE MAIN PHASES CREATE AND IMPORT A DATABASE 6 CONTROL DATABASE IMPROVE DATABASE
  • 7. 1. CREATE A DATABASE Let’s start by converting our Excel Spreadsheet to a CSV File 7
  • 8. 8 1. Download two CSV files in TD Workshop 1 Folder 2. Use the Guideline to add the CSV files to correct folder 3. Insert into PostgreSQL using the given queries
  • 9. 1. Creating Database 2. Creating Student Form table 9
  • 10. Create food truck table ✖ Attributes: ○ foodtruck_id ○ foodtruck_name ○ address ○ zipcode ○ description ○ phone ○ open_hour 10
  • 11. 2. CONTROL AND MANIPULATE DATABASE Let’s learn some SQL functions, shall we? 11
  • 12. Querying data ✖ SELECT ✖ SELECT DISTINCT 12 ✖ SELECT * FROM student_form ✖ SELECT DISTINCT food_truck FROM student_form
  • 13. filtering data ✖ WHERE ✖ LIMIT ✖ OFFSET & FETCH 13 ✖ BETWEEN ✖ IS NULL ✖ LIKE
  • 14. Practice round ✖ What is the name of all of the seniors participating in the workshop? (Hint: WHERE) ✖ What are the top five study places? (Hint: LIMIT) ✖ Select the 6th to the 10th food trucks in the list (Hint: FETCH & OFFSET) ✖ Which students spend between 5 to 8 hours to study? (Hint: BETWEEN) ✖ Which food trucks do not have a phone number? How many of them are there? (Hint: IS NULL) 14
  • 15. Practice round ✖ Which food trucks do not have a phone number OR do not have open hours? (Hint:IS NULL) ✖ Which food trucks do not have both a phone number AND open hours? (Hint: IS NULL) ✖ Which food trucks start with the letter ‘T’? (Hint: LIKE) ✖ Which food trucks end with the letter ‘a’? (Hint: LIKE) ✖ Which food trucks have ‘o’ in any position? (Hint: LIKE) 15
  • 16. Grouping data ✖ GROUP BY ✖ HAVING ✖ ORDER BY - ASC and DESC 16
  • 17. Practice round ✖ How many students are tea people/coffee lovers and have an online class this semester? (Hint: GROUP BY) ✖ How many international students in each year? (Hint: GROUP BY) ✖ How many juniors have TTH class? (Hint: GROUP BY) 17
  • 18. Practice round ✖ How many students study less than 10 hours? (Hint: HAVING) ✖ Which year has the least amount of students? (Hint: ORDER BY) ✖ Which year has the most amount of students? (Hint: ORDER BY) 18
  • 19. Aggregate functions ✖ AVG() and ROUND(X,2) ✖ COUNT() ✖ MAX() ✖ MIN() ✖ SUM() 19
  • 20. Practice round ✖ Which year studies the most hours, on average? (Hint: AVG()) ✖ What is the rounded average hour that students spend studying and using social media? (Hint: ROUND()) ✖ How many students are in each year? (Hint: COUNT()) 20
  • 21. Practice round ✖ How many students are sophomores? (Hint: COUNT()) ✖ What is the maximum hour spent studying from each class? (Hint: MAX()) ✖ What is the minimum hour spent on social media from each year? (Hint: MIN()) 21
  • 22. alias ✖ AS - Column alias 22 ✖ SELECT first_name || ‘ ’ || last_name AS full_name, class_rank FROM student_form;
  • 23. 3. IMPROVE DATABASE Why not make it more robust and detailed? 23
  • 25. Practice round ✖ Join the description and open_hours columns from food_truck table to the student_form table (choose 3 columns first_name, study_place, and food_truck) (Hint: LEFT-JOIN) 25
  • 26. Edit Values ✖ UPDATE …. SET ✖ INSERT INTO ….. VALUES ✖ DELETE FROM ✖ ALTER TABLE …. DROP COLUMN 26
  • 27. Practice round ✖ Look at rows 25, 44, and 48, do you notice any differences? (Hint: UPDATE….SET…) ✖ Nhi hasn’t filled in the form, add her information in! (Hint: INSERT INTO … VALUES…) ✖ Delete Nhi’s values from the table (Hint: DELETE FROM) ✖ Drop column zipcode from the food_truck table (Hint: ALTER TABLE … DROP COLUMN) 27
  • 28. LEARNING RESOURCES Aka extra homework/exercises? 28
  • 29. LEARNING RESOURCES ✖ PostgreSQL 11 in 7 days ✖ PostgreSQL Basic Functions ✖ PostgreSQl practice exercises and tutorial 29
  • 30. AIS Attendance & Feedback FORM bit.ly/TD1SAT 30 Exit code: Bunny SUITABLE POINTS