added shit

This commit is contained in:
Jurn Wubben 2025-02-21 11:26:08 +00:00
parent 1854d56b4a
commit f50efb55f7
5 changed files with 146 additions and 1 deletions

View file

@ -1 +1,43 @@
# SQL
[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/gRBNb6cO)
# Toets Databases
Succes met de toets!
Open **queries.sql** en voer de opdrachten uit.
In `db.png` kan je een schema van de hele database zien.
Als je
```python
python run.py
```
in de console uitvoert, kan je het resultaat van je queries zien. Controleer goed of je het goede antwoord hebt gevonden.
## Voorbeelden
| Operatie | Syntax |
|------------------|-----------------------------------------------------------|
| **Tabel maken** | `CREATE TABLE naam (attribuut VARCHAR(50));` |
| **Data toevoegen** | `INSERT INTO naam VALUES (waarde);` |
| **Data selecteren** | `SELECT ... FROM tabelnaam;` |
| **Data filteren** | `SELECT ... FROM tabelnaam WHERE ...;` |
| **Data orderen** | `SELECT ... FROM tabelnaam ORDER BY ... (ASC or DESC);` |
| **Tellen** | `SELECT COUNT(...) FROM ...;` |
| **Tel unieke waarden** | `SELECT COUNT(DISTINCT ...) from ...;` |
| **Grootste** | `SELECT MAX(...) FROM ...;` |
| **Kleinste** | `SELECT MIN(...) FROM ...;` |
| **Som** | `SELECT SUM(...) FROM ...;` |
## Joins
```SQL
select albums.title, artists.name
from artists
join albums on artists.artistid = albums.artistid
```