Jed Rembold
Monday, August 25, 2025
| First Name | Last Name | Birthday |
|---|---|---|
| Frank | Stein | 4/2/2000 |
| Tessa | Loch | 8/23/2003 |
| Bobby | Wolf | 12/14/2005 |
As the previous slide may have suggested, you could store the information in some sort of table or comma separate values (CSV) file:
| First Name | Last Name | Birthday |
|---|---|---|
| Frank | Stein | 4/2/2000 |
| Tessa | Loch | 8/23/2003 |
| Bobby | Wolf | 12/14/2005 |
First Name,Last Name,Birthday
Frank,Stein,4/2/2000
Tessa,Loch,8/23/2003
Bobby,Wolf,12/14/2005
Alternatively, you might use some other form of common data structure like JSON to store the information:
[
{"First Name": "Frank",
"Last Name": "Stein",
"Birthday": "4/2/2000"},
{"First Name": "Tessa",
"Last Name": "Loch",
"Birthday": "8/23/2003"},
{"First Name": "Bobby",
"Last Name": "Wolf",
"Birthday": "12/14/2005"}
]
| First Name | Last Name | Birthday | Class | Class Day | Class Time |
|---|---|---|---|---|---|
| Frank | Stein | 4/2/2000 | CS151 | MWF | 1:00pm |
| Frank | Stein | 4/2/2000 | MATH256 | MWF | 9:00am |
| Tessa | Loch | 8/23/2003 | CS151 | MWF | 1:00pm |
| Tessa | Loch | 8/23/2003 | IDS236 | TTh | 1:00pm |
| Tessa | Loch | 8/23/2003 | HIST123 | MWF | 12:00pm |
| Bobby | Wolf | 12/14/2005 | IDS236 | TTh | 1:00pm |
| Bobby | Wolf | 12/14/2005 | MATH256 | MWF | 9:00am |
[
{"First Name": "Frank", "Last Name": "Stein", "Birthday": "4/2/2000",
"Classes": [
{"class": "CS151", "day": "MWF", "time":"1:00pm"},
{"class": "MATH256", "day": "MWF", "time":"9:00am"}
]},
{"First Name": "Tessa", "Last Name": "Loch", "Birthday": "8/23/2003",
"Classes": [
{"class": "CS151", "day": "MWF", "time":"1:00pm"},
{"class": "IDS236", "day": "TTh", "time":"1:00pm"},
{"class": "HIST123", "day": "MWF", "time":"12:00pm"}
]},
{"First Name": "Bobby", "Last Name": "Wolf", "Birthday": "12/14/2005",
"Classes": [
{"class": "IDS236", "day": "TTh", "time":"1:00pm"},
{"class": "MATH256", "day": "MWF", "time":"9:00am"}
]},
]
| First Name | Last Name | Birthday |
|---|---|---|
| Frank | Stein | 4/2/2000 |
| Tessa | Loch | 8/23/2003 |
| Bobby | Wolf | 12/14/2005 |
| Class | Day | Time |
|---|---|---|
| CS151 | MWF | 1:00pm |
| MATH256 | MWF | 9:00am |
| IDS236 | TTh | 1:00pm |
| HIST123 | MWF | 12:00pm |
| PHYS221 | MWF | 10:00pm |
int for integersvarchar for textdate for datesSQL has commands to help with the administration of the database, as well as creating, manipulating, and querying specific tables within the database
New installs will come with a database already existing (called
postgres), but it is a good idea to create a
new one and leave the default untouched.
Can run SQL commands either by opening the terminal or running the command in a query.
To create a new database, the syntax is:
CREATE DATABASE |||name_of_database|||;CREATE TABLE |||table name||| (
|||column_name₁||| |||type₁|||,
|||column_name₂||| |||type₂|||,
etc...
);
INSERT INTO |||tablename||| (|||colname₁|||, |||colname₂|||)
VALUES ('row1a', 'row1b'),
('row2a', 'row2b'),
('row3a', 'row3b');