Click here to Skip to main content
15,888,527 members
Home / Discussions / Database
   

Database

 
GeneralRe: members db or table? Pin
Jassim Rahma16-May-11 4:02
Jassim Rahma16-May-11 4:02 
GeneralRe: members db or table? Pin
dasblinkenlight16-May-11 4:10
dasblinkenlight16-May-11 4:10 
AnswerRe: members db or table? Pin
Shameel17-May-11 4:34
professionalShameel17-May-11 4:34 
QuestionUsing a variable table [modified] Pin
MAW3014-May-11 9:28
MAW3014-May-11 9:28 
AnswerRe: Using a variable table Pin
jschell14-May-11 11:39
jschell14-May-11 11:39 
QuestionDynamic column based on row Pin
Ramkumar_S13-May-11 23:26
Ramkumar_S13-May-11 23:26 
AnswerRe: Dynamic column based on row Pin
dasblinkenlight15-May-11 22:47
dasblinkenlight15-May-11 22:47 
QuestionMySql Foreign key referencing Pin
sajid.salim.khan13-May-11 21:39
sajid.salim.khan13-May-11 21:39 
I m a new bee i have used sql server 2000 before my question is when creating two tables in sql server 2000 say
location and projects table projects having a foreign key referencing the location table when inserting values in
location the projects is also updated thats is no need to insert the similar value in the foreign key in projects table
why is it not possible in mysql when i insert values in location using insert command and when using select command on
projects it does not shows the value in foreign key please check the below code

mysql> create table location(
-> id int not null,
-> primary key(id))
-> engine=innodb;
Query OK, 0 rows affected (0.11 sec)


mysql> create table projects(
-> id int,
-> location_id int,
-> foreign key(location_id) references location(id) on update cascade on del
ete cascade)
-> engine=innodb;
Query OK, 0 rows affected (0.31 sec)


mysql> insert into location values('1')
Query OK, 1 row affected (0.34 sec)

mysql> select * from location;
+----+
| id |
+----+
| 1 |
+----+
1 row in set (0.00 sec)

mysql> select * from projects;
Empty set (0.00 sec)

as u see in the above code it was possible in sql server 2000 that the value was reflected in the child table why is
it not possible in MySql Why should the value be insert in both the tables isn't it possible in MySql that when i insert
in the location table the projects table pick the value automatically and show it in select Query when i query the projects table
AnswerRe: MySql Foreign key referencing Pin
Shameel17-May-11 4:38
professionalShameel17-May-11 4:38 
QuestionMySql Foreign key Pin
sajid.salim.khan13-May-11 21:24
sajid.salim.khan13-May-11 21:24 
AnswerRe: MySql Foreign key Pin
jschell14-May-11 11:42
jschell14-May-11 11:42 
QuestionSql Server Fetching Data Pin
Ravi_2112-May-11 22:28
Ravi_2112-May-11 22:28 
AnswerRe: Sql Server Fetching Data Pin
Groulien12-May-11 22:40
Groulien12-May-11 22:40 
AnswerRe: Sql Server Fetching Data Pin
Simon_Whale13-May-11 0:41
Simon_Whale13-May-11 0:41 
AnswerRe: Sql Server Fetching Data Pin
SilimSayo13-May-11 3:22
SilimSayo13-May-11 3:22 
AnswerRe: Sql Server Fetching Data Pin
jschell13-May-11 9:03
jschell13-May-11 9:03 
AnswerRe: Sql Server Fetching Data Pin
Shameel17-May-11 4:41
professionalShameel17-May-11 4:41 
QuestionDuplicate a record Pin
solomon1300012-May-11 4:28
solomon1300012-May-11 4:28 
AnswerRe: Duplicate a record Pin
SilimSayo12-May-11 8:38
SilimSayo12-May-11 8:38 
QuestionView Pin
Dhyanga12-May-11 3:50
Dhyanga12-May-11 3:50 
AnswerRe: View Pin
Blue_Boy12-May-11 4:26
Blue_Boy12-May-11 4:26 
GeneralRe: View Pin
David Skelly13-May-11 2:22
David Skelly13-May-11 2:22 
GeneralRe: View Pin
Shameel17-May-11 4:45
professionalShameel17-May-11 4:45 
AnswerRe: View Pin
SilimSayo12-May-11 5:46
SilimSayo12-May-11 5:46 
AnswerRe: View Pin
Shameel17-May-11 4:48
professionalShameel17-May-11 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.