vault backup: 2026-07-23 09:10:20

This commit is contained in:
Benjamin Neumann
2026-07-23 09:10:20 +02:00
parent 1de34419bc
commit ec569e7e22
3 changed files with 69 additions and 52 deletions
+1
View File
@@ -220,6 +220,7 @@
"lastOpenFiles": [
"SS2026/Datenbanken und Informationssysteme/SQL/Anhänge/sql_merged.pdf",
"SS2026/Datenbanken und Informationssysteme/SQL/SQL.md",
"SS2026/Datenbanken und Informationssysteme/SQL/DDL Data Definition Language SQL.md",
"SS2026/Datenbanken und Informationssysteme/Datenbanken und Informationssysteme.md",
"SS2026/Klausurplan.canvas",
"SS2026/Datenbanken und Informationssysteme/Relationales Datenmodell/Relationales Datenmodell.md",
@@ -0,0 +1,59 @@
### CREATE TABLE
```
CREATE TABLE table_name (
column_name1 data_type1 constraints1,
...
)
```
names = Namen
type = Datentyp INTEGER, CHAR(n), DATE...
constraints = NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY...
FOREIGN KEY A REFERENCES B(A)
### ALTER TABLE
```
ALTER TABLE table_name #vor allen Befehlen
---
ADD column_name data_type [constraint];
---
DROP COLUMN column_name;
---
ALTER COLUMN column_name new_data_type;
---
ADD CONSTRAINT constraint_name constraint_type (column_name);
---
DROP CONSTRAINT constraint_name;
```
DROP TABLE (IF EXISTS) table_name : löscht Tabelle + Daten
### CREATE VIEW
Erstellt Relation mit der gearbeitet werden kann
Bsp.:
```
CREATE VIEW Langzeit_Studierende AS
SELECT * FROM Student WHERE Semester >= 10;
```
DROP VIEW Name zum löschen
### Indexe
Effizienteres Suchen in Tabellen
```
CREATE [UNIQUE] INDEX <name>
ON <Relationsname> (<Attributname> [<Ordnung>]{, <Attributname>
[<Ordnung>]})
```
UNIQUE für eindeutigen Index optional
Relationsname = Tabelle
Attributname = Spalte
Ordnung = ASC / DESC
Bsp.:
```
CREATE UNIQUE INDEX idx_student_semester
ON Student (Semester ASC);
```
DROP INDEX Name zum löschen
@@ -8,62 +8,19 @@ Duplikate möglich!!!
1. CREATE TABLE: zum Erstellen einer neuen Tabelle
2. ALTER TABLE: zum Ändern einer bestehenden Tabelle
3. DROP TABLE: zum Löschen einer Tabelle
[[DDL Data Definition Language SQL]]
## SQL Data Manipulation Language DML
1. INSERT
2. UPDATE
3. DELETE
### CREATE TABLE
### INSERT
```
CREATE TABLE table_name (
column_name1 data_type1 constraints1,
...
)
```
names = Namen
type = Datentyp INTEGER, CHAR(n), DATE...
constraints = NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY...
FOREIGN KEY A REFERENCES B(A)
### ALTER TABLE
```
ALTER TABLE table_name #vor allen Befehlen
---
ADD column_name data_type [constraint];
---
DROP COLUMN column_name;
---
ALTER COLUMN column_name new_data_type;
---
ADD CONSTRAINT constraint_name constraint_type (column_name);
---
DROP CONSTRAINT constraint_name;
INSERT INTO <tabelle> (spalte1, spalte2, ...) VALUES (wert1, wert2, ...);
```
DROP TABLE (IF EXISTS) table_name : löscht Tabelle + Daten
### CREATE VIEW
Erstellt Relation mit der gearbeitet werden kann
Bsp.:
### UPDATE
```
CREATE VIEW Langzeit_Studierende AS
SELECT * FROM Student WHERE Semester >= 10;
UPDATE <tabelle> SET spalte1 = wert1, spalte2 = wert2, ... WHERE <bedingung>;
```
DROP VIEW Name zum löschen
### Indexe
Effizienteres Suchen in Tabellen
```
CREATE [UNIQUE] INDEX <name>
ON <Relationsname> (<Attributname> [<Ordnung>]{, <Attributname>
[<Ordnung>]})
```
UNIQUE für eindeutigen Index optional
Relationsname = Tabelle
Attributname = Spalte
Ordnung = ASC / DESC
Bsp.:
```
CREATE UNIQUE INDEX idx_student_semester
ON Student (Semester ASC);
```
DROP INDEX Name zum löschen