Unix Technical Forum

Koreign Key

This is a discussion on Koreign Key within the MySQL forums, part of the Database Server Software category; --> hi I can make an tree using reference (foreing) key on self table? example command SQL: create table a ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 10:21 AM
gabryfan
 
Posts: n/a
Default Koreign Key

hi

I can make an tree using reference (foreing) key on self table?

example

command SQL:
create table a (
ID INT not null auto_increment,
n varchar(100),
x int,
primary key ID,
Constraint n forign_key (x) references a(ID) on delete cascade on update
cascade
)
egine InnoDB.

This Instraction can be running on mysql 5.0

thank's
gabry

webmaster di www.fantogame.it


buongiorno

Io posso creare un albero usando reference (foreing) key sulla stessa
tabella:

instruzione SQL:



create table a (
ID INT not null auto_increment,
x varchar(100),
x int,
primary key ID,
Constraint n forign_key (x) references a(x) on delete cascade on update
cascade
)

egine InnoDB.


puņ funzionare su mysql 5.0 ocrea qualche intoppo.

grazie gabry

webmaster di
www.fantogame.it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 10:21 AM
ZeldorBlat
 
Posts: n/a
Default Re: Koreign Key

On Aug 4, 4:50 pm, gabryfan <gabriele.fant...@fantogame.it> wrote:
> hi
>
> I can make an tree using reference (foreing) key on self table?
>
> example
>
> command SQL:
> create table a (
> ID INT not null auto_increment,
> n varchar(100),
> x int,
> primary key ID,
> Constraint n forign_key (x) references a(ID) on delete cascade on update
> cascade
> )
> egine InnoDB.
>
> This Instraction can be running on mysql 5.0
>
> thank's
> gabry
>
> webmaster diwww.fantogame.it
>
> buongiorno
>
> Io posso creare un albero usando reference (foreing) key sulla stessa
> tabella:
>
> instruzione SQL:
>
> create table a (
> ID INT not null auto_increment,
> x varchar(100),
> x int,
> primary key ID,
> Constraint n forign_key (x) references a(x) on delete cascade on update
> cascade
> )
>
> egine InnoDB.
>
> puņ funzionare su mysql 5.0 ocrea qualche intoppo.
>
> grazie gabry
>
> webmaster diwww.fantogame.it


Did you try creating that table to see what would happen? You've
already written the SQL so it shouldn't be too much of a stretch to
run it.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 10:21 AM
gabryfan
 
Posts: n/a
Default Re: Koreign Key

ZeldorBlat ha scritto:
> On Aug 4, 4:50 pm, gabryfan <gabriele.fant...@fantogame.it> wrote:
>> hi
>>
>> I can make an tree using reference (foreing) key on self table?
>>
>> example
>>
>> command SQL:
>> create table a (
>> ID INT not null auto_increment,
>> n varchar(100),
>> x int,
>> primary key ID,
>> Constraint n forign_key (x) references a(ID) on delete cascade on update
>> cascade
>> )
>> egine InnoDB.
>>
>> This Instraction can be running on mysql 5.0
>>
>> thank's
>> gabry
>>
>> webmaster diwww.fantogame.it
>>
>> buongiorno
>>
>> Io posso creare un albero usando reference (foreing) key sulla stessa
>> tabella:
>>
>> instruzione SQL:
>>
>> create table a (
>> ID INT not null auto_increment,
>> x varchar(100),
>> x int,
>> primary key ID,
>> Constraint n forign_key (x) references a(x) on delete cascade on update
>> cascade
>> )
>>
>> egine InnoDB.
>>
>> puņ funzionare su mysql 5.0 ocrea qualche intoppo.
>>
>> grazie gabry
>>
>> webmaster diwww.fantogame.it

>
> Did you try creating that table to see what would happen? You've
> already written the SQL so it shouldn't be too much of a stretch to
> run it.
>


How I Must Written the SQL instruction?
thank's

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 10:21 AM
ZeldorBlat
 
Posts: n/a
Default Re: Koreign Key

On Aug 4, 4:59 pm, gabryfan <gabriele.fant...@fantogame.it> wrote:
> ZeldorBlat ha scritto:
>
>
>
> > On Aug 4, 4:50 pm, gabryfan <gabriele.fant...@fantogame.it> wrote:
> >> hi

>
> >> I can make an tree using reference (foreing) key on self table?

>
> >> example

>
> >> command SQL:
> >> create table a (
> >> ID INT not null auto_increment,
> >> n varchar(100),
> >> x int,
> >> primary key ID,
> >> Constraint n forign_key (x) references a(ID) on delete cascade on update
> >> cascade
> >> )
> >> egine InnoDB.

>
> >> This Instraction can be running on mysql 5.0

>
> >> thank's
> >> gabry

>
> >> webmaster diwww.fantogame.it

>
> >> buongiorno

>
> >> Io posso creare un albero usando reference (foreing) key sulla stessa
> >> tabella:

>
> >> instruzione SQL:

>
> >> create table a (
> >> ID INT not null auto_increment,
> >> x varchar(100),
> >> x int,
> >> primary key ID,
> >> Constraint n forign_key (x) references a(x) on delete cascade on update
> >> cascade
> >> )

>
> >> egine InnoDB.

>
> >> puņ funzionare su mysql 5.0 ocrea qualche intoppo.

>
> >> grazie gabry

>
> >> webmaster diwww.fantogame.it

>
> > Did you try creating that table to see what would happen? You've
> > already written the SQL so it shouldn't be too much of a stretch to
> > run it.

>
> How I Must Written the SQL instruction?
> thank's


create table a (
ID INT not null auto_increment,
n varchar(100),
x int,
primary key ID,
Constraint n forign_key (x) references a(ID) on delete cascade on
update
cascade
)
egine InnoDB

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:14 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com