Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
modul:m290:learningunits:lu05:theorie:02 [2024/09/25 16:11] – vdemir | modul:m290:learningunits:lu05:theorie:02 [2024/10/17 12:43] (aktuell) – vdemir | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | ====== | + | ====== |
**Source**: | **Source**: | ||
- | * [[https:// | + | * [[https:// |
- | * [[https:// | + | * [[https:// |
- | * [[https:// | + | * [[https:// |
===== Learning Objectives ===== | ===== Learning Objectives ===== | ||
In this learning unit, we will learn how to manage database tables, i.e. | In this learning unit, we will learn how to manage database tables, i.e. | ||
- | -how to create | + | - how to create |
- | -how to modify and | + | - how to modify and |
- | -how to delete database tables. | + | - how to delete database tables |
===== CREATE TABLE ===== | ===== CREATE TABLE ===== | ||
Let's start by creating a table based on the ERD of the student management tool, as shown below: | Let's start by creating a table based on the ERD of the student management tool, as shown below: | ||
- | Our goal is to create the table " | + | Our goal is to create the table " |
CREATE TABLE table_name ( | CREATE TABLE table_name ( | ||
Zeile 25: | Zeile 25: | ||
In our example the our concrete CREATE statement would look like: | In our example the our concrete CREATE statement would look like: | ||
+ | '' | ||
CREATE TABLE student ( | CREATE TABLE student ( | ||
stundent_id INT, | stundent_id INT, | ||
Zeile 85: | Zeile 85: | ||
ALTER COLUMN column_name datatype; | ALTER COLUMN column_name datatype; | ||
| | ||
- | And of course, as a concrete practical example, in which we change the length of the column name from 50 characters to 100: | + | And of course, as a concrete practical example, in which we change the length of the column |
ALTER TABLE student | ALTER TABLE student | ||
MODIFY COLUMN name VARCHAR(100); | MODIFY COLUMN name VARCHAR(100); | ||
+ | | ||
+ | ===== DROP TABLE ===== | ||
+ | If, for whatever reason, we have created a table incorrectly or want to get rid of an obsolete table, we need the command DROP TABLE: | ||
+ | |||
+ | DROP TABLE table_name; | ||
+ | |||
+ | **Hint: <color # | ||
==== Vocabulary ==== | ==== Vocabulary ==== | ||
^English ^ Deutsch ^ | ^English ^ Deutsch ^ | ||
- | | ::: | ... | | + | | column |
---- | ---- | ||
[[https:// | [[https:// | ||