Jump to content

Recommended Posts

Salam hormat otai2 putera smua.nak tnya tentang pernormalan database.

sy ada buat satu booking system ni. ada 4 table untuk customers:

 

Pending_customers:

field

=====

user_id

email

nama

alamat

no_ic

kereta

tarikh_tempahan

tarikh_isi_form

 

Confirmed_customers:

=================

 

user_id

email

nama

alamat

no_ic

kereta

tarikh_tempahan

 

Rejected_customers:

================

 

user_id

email

nama

alamat

no_ic

kereta

tarikh_tempahan

 

soalan:adakah betul pernormalan yg dibuat ni? atau nak kena normal kan lg. mohon pencerahan pakar2 smua.terimakasih.

 

Share this post


Link to post
Share on other sites

Table Customer sepatutnya ada 1 table sahaja;

 

user_id

nama

no_ic

email

alamat

 

Table Kereta buat satu table yang lain;

 

CarID

PlatNo

Model

...........................

 

Action buat satu table lain;

 

ActionID 

tarikhisiborang

tarikhtempahan

pending

approved/confirm

rejected

Edited by KopiKawKaw2012

Share this post


Link to post
Share on other sites

Kalau tanya pada saya, saya akan buat macam ini

 

Table customer

-User_ID

-Name

-Contact_Number

 

Table booking

-Book_ID

-User_ID

-Car_ID

-Date_Booking

-Date_Approved

-Approved_by

-Status_Book contoh : (Pending, Approved,Reject)

 

Table car

-Car_ID

-Model

-No_Plat

 

So bila bro buat query seperti ini

 

SELECT *
FROM customer C INNER JOIN booking B ON C.User_ID = B.User_ID INNER JOIN car CAR ON 
B.Car_ID = CAR.Car_ID;
USER_ID  NAME  CONTACT BOOK_ID D.BOOK   D.APRV   APPRV BY  STATUS  CAR_ID MODEL   NO 
PLAT

    1   Chuki2 01234567   1    1/1/2013 2/1/2013 Michael   Approved   1   Proton   WEQ 111

 

Jadi harap dapat membantu...:)

Share this post


Link to post
Share on other sites

Kalau tanya pada saya, saya akan buat macam ini

 

Table customer

-User_ID

-Name

-Contact_Number

 

Table booking

-Book_ID

-User_ID

-Car_ID

-Date_Booking

-Date_Approved

-Approved_by

-Status_Book contoh : (Pending, Approved,Reject)

 

Table car

-Car_ID

-Model

-No_Plat

 

So bila bro buat query seperti ini

 

SELECT *
FROM customer C INNER JOIN booking B ON C.User_ID = B.User_ID INNER JOIN car CAR ON 
B.Car_ID = CAR.Car_ID;
USER_ID  NAME  CONTACT BOOK_ID D.BOOK   D.APRV   APPRV BY  STATUS  CAR_ID MODEL   NO 
PLAT

    1   Chuki2 01234567   1    1/1/2013 2/1/2013 Michael   Approved   1   Proton   WEQ 111

 

Jadi harap dapat membantu... :)

thanks tuan..bagus juga ni..sbb tadi duk pikir jugak status booking tu nak letak statement ape. relationship dari table customer tu ke table booking tu guna User_ID la kan.n table car join table booking guna Car_ID . betul cmtu? 

Share this post


Link to post
Share on other sites

Yup bro, 10 markah untuk bro... :D

 

FK (Foreign Key) akan digunakan pada table booking ialah Car_ID dan User_ID..

 

So dengan kata mudah, table user dan car akan join pada table booking...;)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...