Typname | Wertebereich | Beispiele |
---|---|---|
integer | ganze Zahlen | -100, 200 |
decimal(5,3) | Festkommazahlen | 10,156 |
float | Gleitkommazahlen | 10,154789 |
varchar(10) | Zeichenketten variabler Länge | 'Hallo' |
date | Datum | 1.1.2007 14:30:12 |
Kompakte Form (ohne Datentypen)
Darstellung mit Datentypen
CREATE TABLE ucla.student (
sid INTEGER NOT NULL,
matrnr VARCHAR2(10) NOT NULL,
name VARCHAR2(200) NOT NULL,
vorname VARCHAR2(200) NOT NULL,
immadatum DATE NOT NULL,
exmadatum DATE,
sg INTEGER NOT NULL
);
ALTER TABLE ucla.student
ADD CONSTRAINT pk_student PRIMARY KEY ( sid );
CREATE TABLE ucla.studiengang (
sgid INTEGER NOT NULL,
name VARCHAR2(200) NOT NULL,
standort VARCHAR2(50) NOT NULL
);
ALTER TABLE ucla.studiengang
ADD CONSTRAINT pk_studiengang
PRIMARY KEY ( sgid );
CREATE TABLE ucla.student (
...
sg INTEGER NOT NULL
);
CREATE TABLE ucla.studiengang (
sgid INTEGER NOT NULL,
...
);
ALTER TABLE ucla.student
ADD CONSTRAINT fk_student_sg FOREIGN KEY ( sg ) REFERENCES ucla.studiengang ( sgid );
CREATE TABLE ucla.student (
...
sg INTEGER
);
CREATE TABLE ucla.studiengang (
sgid INTEGER NOT NULL,
...
);
ALTER TABLE ucla.student
ADD CONSTRAINT fk_student_sg FOREIGN KEY ( sg ) REFERENCES ucla.studiengang ( sgid );
CREATE TABLE ucla.student (
...
sg INTEGER NOT NULL
);
CREATE TABLE ucla.studiengang (
sgid INTEGER NOT NULL,
...
);
ALTER TABLE ucla.student
ADD CONSTRAINT fk_student_sg FOREIGN KEY ( sg ) REFERENCES ucla.studiengang ( sgid )
ON DELETE CASCADE;
CREATE TABLE ucla.student (
...
sg INTEGER
);
CREATE TABLE ucla.studiengang (
sgid INTEGER NOT NULL,
...
);
ALTER TABLE ucla.student
ADD CONSTRAINT fk_student_sg FOREIGN KEY ( sg ) REFERENCES ucla.studiengang ( sgid )
ON DELETE CASCADE;
INSERT INTO STUDENT(SID, MATRNR, NAME, VORNAME, IMMADATUM, SG)
VALUES (4, '505790', 'Al-Hasan', 'Mohammed', '01.10.2023', 1)
UPDATE STUDENT SET VORNAME='Mohamed' WHERE SID=4
DELETE FROM STUDENT WHERE SID=4