Dies ist eine statische Kopie unseres alten Forums. Es sind keine Interaktionen möglich.
This is a static copy of our old forum. Interactions are not possible.

Neutrino

masselos

  • "Neutrino" is male
  • "Neutrino" started this thread

Posts: 661

Date of registration: Oct 6th 2005

Location: Hannover

Occupation: SRA Mitarbeiter

1

Thursday, May 17th 2007, 2:45pm

SQL Übung 5

Hallo,
Ich hab mal ne Frage zu der aktuellen SQL Übung:

Wie funktioniert denn "on delete cascade"? Muss ich das anstelle von "foreign key" verwenden oder ein extra constraint bauen? Wie ist denn die Syntax dazu?
MfG
Henning

Sinan

Senior Schreiberling

  • "Sinan" is male

Posts: 1,021

Date of registration: Jul 5th 2003

Location: Malaga

Occupation: Senior Cloud Solution Engineer bei Oracle

2

Thursday, May 17th 2007, 3:53pm

RE: SQL Übung 5

Einfach am Ende dranhängen

CREATE TABLE tabellenname
(spalte1 INT,
spalte2 VARCHAR(16),
....,
FOREIGN KEY (spalte1) REFERENCES spalteInDerAnderenTabelle ON DELETE CASCADE)
With great power comes great responsibility

Neutrino

masselos

  • "Neutrino" is male
  • "Neutrino" started this thread

Posts: 661

Date of registration: Oct 6th 2005

Location: Hannover

Occupation: SRA Mitarbeiter

3

Thursday, May 17th 2007, 3:59pm

Thx!
Mitlerweile ist aber noch eine Frage zu Aufgabenteil b aufgetaucht: wie kann man einen primary key beim erstellen einer Tabelle festlegen,wenn man die "AS" Klausel benutzt?
hab nun schon ein dutzend Möglichkeiten ausprobiert.
MfG
Neutrino

Currywurst mit Pommes

Erfahrener Schreiberling

Posts: 438

Date of registration: Oct 14th 2002

4

Thursday, May 17th 2007, 7:17pm

CREATE TABLE wie gewohnt (ohne type) - und dann hängst du das AS Zeug einfach hinten dran

Neutrino

masselos

  • "Neutrino" is male
  • "Neutrino" started this thread

Posts: 661

Date of registration: Oct 6th 2005

Location: Hannover

Occupation: SRA Mitarbeiter

5

Friday, May 18th 2007, 7:25am

boah, habs noch hinbekommen. man kann ja irgendwie kein constraint einfügen innerhalb des AS Ausdrucks...aber egal, nun funktionierts, thx für die hilfe