Dies ist eine alte Version des Dokuments!


LU06b - SQL-DDL: Table Management

In this learning unit, we will learn how to manage database tables, i.e. how to create, modify and delete database tables.

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 „stundent“ on our database. For that we need to know how the basic syntax for creating table is.

CREATE TABLE table_name (
    column1 datatype,
    column2 datatype,
    column3 datatype,
   ....
);

In our example the our concrete CREATE statement would look like:

CREATE TABLE student (
  stundent_id INT,
  name VARCHAR(50),
  surname VARCHAR(50),
  birthdate DATE,
  matrno CHAR(6)
);

After executing the DDL create statement, the result would look like the following figure.

Hints:

  • On the right upper side you can see, that the table „student“ has actually been created.
  • After a select on this table, we can see that the table does not yet contain any data.
  • It's not a big deal so far, is it? 8-).
English Deutsch

Volkan Demir

  • modul/m290/learningunits/lu05/theorie/02.1727268120.txt.gz
  • Zuletzt geändert: 2024/09/25 14:42
  • von vdemir