Introduce students to PostgreSQL and some basic database management requirements. In order to make it more approachable and relatable to Temple students community
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
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
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
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
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;
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