0

私は現在、PHP と MySQL を学ぶための新しいベンチャーに着手しています。過去に Access を使用して単純なデータベースを作成したことがありますが、これは、連絡先やプロジェクト情報を含む無数のデータを追跡するための Web 中心のデータベースです。さまざまな関係でさまざまなテーブルをリンクする必要がありますが、それを行う最善の方法がわかりません。私は PHP/MySQL を使い始めたばかりなので、できるだけ多くの学習のためにオンライン ソースを調査しています。おすすめの本やサイトなどありましたら、よろしくお願いします。

テーブルをセットアップする際に、私が関心を持っている主要な領域の 1 つは連絡先です。従業員、クライアント、ベンダー、下請け業者など、さまざまな連絡先があります。1 つの連絡先が複数のタイプになる可能性があり、各タイプには、それらに関連するさまざまな追加フィールドがあります。私の考えは、さまざまな連絡先タイプの他のテーブルにリンクする 1 つの連絡先テーブルを用意することでした。どのフィールド タイプまたはテーブル オプションの設定が最適かわかりません...

このシナリオは、データベースの他の領域だけでなく、プロジェクトや製品にも適用される可能性があります。

ポインタ/方向性をいただければ幸いです。

ウェス

4

3 に答える 3

0

オブジェクト指向設計に精通していますか。

MySQL などの RDBMS では、次のようにデータベースを設計します。

  • 連絡先(名、姓など)
    • 従業員
    • ベンダー
    • クライアント

拡張 するテーブルには、関係を作成Contactsする特定のデータとcontact_id列が保持されます。

余談ですが、NoSQLソリューションは厳格なスキーマを持たないため、この問題をネイティブに解決します。つまり、レコードごとにさまざまなデータを保存できます。

于 2012-06-05T16:38:29.480 に答える
0

I would give a little thought to how you're going to use those extended fields. Certainly create a table for contacts, and you definitely could create a table for each contact type (employees, clients, etc) with a column connecting the record to the contact table (thus employees would have employee_id, contact_id, propertyOne, propertyTwo, etc).

Another option though, which may be convenient if your application is contact centric and you really just want to be able to associate different kinds of information with contacts, would be to have a contact table, a table containing the types of extended information (say "contactTypes" and it would have the information that a vendor type has a billing address for example) and a third table to actually hold all the data (name-value pairs). This is a bit more fluid in that it will let you add new types of contacts or add fields to a type without actually altering your schema. The first option (Jason McCreary's) might scale better if you're going to have many, many records...

Regarding resources - there's so much out there, I can't even begin to narrow it down for you - look at the php manual and just google "php mysql tutorial" - tons of stuff.

于 2012-06-05T16:56:03.017 に答える
0

私が大いに役立ったお勧めの本は、Beginning-PHP-MySQL-Novice-Professionalです。

そして、次のビデオを必ず見てください。ただし、基本を知らないと高度になる可能性があります。Bbuild-a-login-system-for-a-simple-website/

データベース関係と紹介については、Coding HORRORをご覧ください。

これが役立つことを願っています..

于 2012-06-05T17:00:51.833 に答える