# Databases

### Learning Objectives <a href="#learning-objectives" id="learning-objectives"></a>

By the end of this lesson students should be able to

* Explain why databases are needed in Web Development
* Define what SQL is and what it is used for
* Describe what `table`, `rows` and `columns` are used for in a relational database
* Install and create a database using PostgreSQL
* Create a table in a database using PostgreSQL
* Insert data into a table using PostgreSQL
* Retrieve data from a table using PostgreSQL
* Retrieve data from a table using conditionals in PostgreSQL
* List the different kinds of data that can be held in a PostgreSQL database
* Add and remove columns in a pre-existing table using PostgreSQL using `ALTER`
* Rename tables and columns in a pre-existing table using PostgreSQL using `DELETE`
* Update rows in a pre-existing table using PostgreSQL using `UPDATE`
* Combine tables together using PostgreSQL using `INNER JOIN`
* Connect a PostgreSQL database to a NodeJS application
* Retrieve data from a PostgreSQL database in a NodeJS application
* Create an API endpoint that can add data to a database
* Write code that effectively validates data before adding it to a database
* Be aware of the dangers of SQL injection attacks, and how to avoid them
* Create an API endpoint that can retrieve data from a database with multiple parameters
* Create an API endpoint that can update data in a database
* Create an API endpoint that can delete data in a database

## Lessons

{% content-ref url="/pages/-MYoHTOqd5WYi92qYOWt" %}
[1 - Introduction to SQL](/coding-course/class-information/teaching-instructions/databases/1-introduction-to-sql.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MYoHd5L3GbryAF8\_NGS" %}
[2 - SQL with Node](/coding-course/class-information/teaching-instructions/databases/2-sql-with-node.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MYoHdeWoSqsd4k7q7M7" %}
[3 - CRUD with SQL and Node](/coding-course/class-information/teaching-instructions/databases/3-crud-with-sql-and-node.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://volunteers.migracode.org/coding-course/class-information/teaching-instructions/databases.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
