View: 2416|Reply: 18
|
Macamane nak link table?
[Copy link]
|
|
hello!!...nak tanya sume, macamana nak link table mysql yakni, mysql yang kat dalam wamp tu? |
Rate
-
1
View Rating Log
-
|
|
|
|
|
|
|
minta maaf tak tahu...
kekawan lain sila tolong |
|
|
|
|
|
|
|
soalan terlalu general. boleh specific sikit? |
|
|
|
|
|
|
|
Reply #3 shahnazz's post
okay..kalo dalam mic.access kita boleh link kan table table or make relationship
one to many, many to many, and other else which kita boleh set kan primary key dan foreign key.
but now, i use wamp.dalam wamp tu kan dia sekalikan mysql+apache+php.
n now saya tak tau macamana nk buat buat relationship table2 kat mysql.
any idea? |
|
|
|
|
|
|
|
Reply #4 HishamZ's post
yang ni guna phpmyadmin tu ke??..
lau phpmyadmin takde related untuk foreign key tu...sebab yang tu just create table dan field...
tapi lau dalam mysql command prompt.. yang ni bleh sebab kita taip arahan semua....
tapi soalan awak ni general la..leh detailkan lagi..takut saya tersalah pemahaman la plak la kan.. |
|
|
|
|
|
|
|
oh
mysql tak sama dengan microsoft access.
mostly primary keys and foreign keys you have to define masa nak create table tu. phpmyadmin is only a UI for mysql database management. biasanya dalam microsoft access you define relationships so that when you create queries in microsoft access, the results would come out properly. actually by defining relationships in microsoft access you are only simplifying your task of scripting in SQL to manage the relationships.
if you look carefully in microsoft access queries, when you establish relationships between tables in your queries, try and look at the SQL code underneath. you will find a lot of JOIN statements (LEFT JOIN, RIGHT JOIN etc), yang tulah u kena pakai dalam MySQL bila nak establish relationships.
correct me if i am wrong |
|
|
|
|
|
|
|
actually, in mysql kita boleh wat relationship if kita gunakan innodb engine. hishamz, kalo u gunakan phpmyadmin, bila u create table, automatically table tu guna myisam engine. so kalo u nak gunakan innodb engine, masa u create table u kena define la yg u nak gunakan engine ape. cthnya mcm ni:
CREATE TABLE table1 (
a varchar(10) NOT NULL,
b varchar(50) NOT NULL,
PRIMARY KEY (a)
) ENGINE=InnoDB |
Rate
-
1
View Rating Log
-
|
|
|
|
|
|
|
Reply #7 keychain's post
ooo innodb boleh create relationships ek?
so kalau nak buat delete from primary table dia akan delete automatically from foreign table ke? (macam cascade delete) |
|
|
|
|
|
|
|
Originally posted by shahnazz at 8-8-2007 10:32 AM
ooo innodb boleh create relationships ek?
so kalau nak buat delete from primary table dia akan delete automatically from foreign table ke? (macam cascade delete)
yes boleh.. either nak on update cascade ke..delete cascade ke.. |
|
|
|
|
|
|
|
ooo good info, baru saya tau, nah credits for u |
|
|
|
|
|
|
|
Reply #7 keychain's post
okay..paham..maknanya,kita just declare kat table yg kita nak link tu foreign key la kan?automatic linked la
kiranya ye.
just nak tanya perbezaan database engine, innodb,myisam, and a fews..lain ke fungsinye? |
|
|
|
|
|
|
|
Hati-hati bila guna mysql innodb. Klu nak buat application yang support transaction, OK. Tapi kalau application yang simple, cukup pakai MyISAM je.
-Antara kelemahan innoDB, tak bleh main copy database folder & masuk dlm dalam mysql server dr pc yang berlainan (ni aku try kat LINUX, windows x pasti), Slow sikit masa insert data. |
|
|
|
|
|
|
|
Reply #12 zarcoss's post
keja copy mengcopy database (either tables are using innodb engine or not) ni sll sy buat, n tak de masalah pulak setakat ni.
either in linux or windows. u copy guna command ke or u ade guna tools? |
|
|
|
|
|
|
|
oo gitu..info yang berguna keychain... tapi awak tau tak tools apa yang bleh digunakan untuk dapatkan diagram bg db tu....
thanks |
|
|
|
|
|
|
|
Reply #15 mygirlz's post
so far, sy tak tau mana2 tools yg boleh dptkan diagram db yg kita dah create. tp sy pelik ngan soalan awak tu, nape dh ade db tu then baru nak dptkan diagramnya? |
|
|
|
|
|
|
|
Reply #16 keychain's post
camni....memang sebelum create db kita da ada rangka table dan link semua...soalan saya ni sebenarnya...saya nak print diagram tu ....(untuk menyenangkan saya supaya takperlu saya nak buat box persemua lagi....).... |
|
|
|
|
|
|
|
Reply #17 mygirlz's post
aiseh....
kalo psl diagram2 ni, itu la pentingnya documentation...
ala...awak lukis je diagram tu then kasi clerk yg buat.. hehehehe..
kalo psl tools maybe awak leh tya ngan forummer lain.
sori ye...no idea la nk tlg bab ni.. |
|
|
|
|
|
|
|
la.. ko cari jer visio.. pastu lukis sendiri diagram tuh.. |
|
|
|
|
|
|
| |
|