Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > Databases - MySQL, SQL, Oracle, Access and others
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 07-26-2005, 07:23 PM   #1 (permalink)
clifford
Junior Member
 
Join Date: Jun 2005
Location: Finland
Posts: 26
Default MySQL - Indexes, Foreign Key, PK

Hi,

I am starting to read up on buiding my own MySQL database for my site. What is the difference between an index, primary key and a foreign key? In the book I am reading by Kevin Yank (Build Your Own Database Driven Website Using PHP & MySQL) he refers to one or the other. Are they the same?
clifford is offline   Reply With Quote
Sponsored Links
Old 07-26-2005, 07:37 PM   #2 (permalink)
websitedatabases
Junior Member
 
Join Date: Jul 2005
Posts: 12
Default

Well here are a few things you should understand:

Database:
A database is a collection of tables, with related data

Table:
A table is a matrix with data. A table in a database looks like a simple spreadsheet.

Column:
One column (data element) contains data of one and the same kind, for example the column postcode.

Row:
A row (= tuple, entry) is a group of related data, for example the data of one subscription. One row can not contain lists.

Primary Key:
MySQL requires a PRIMARY KEY in each table to be able to refer to previously read rows and other queries.

Index:
An index in a database resembles an index at the back of a book.
Using a keyword you can find the right page number of rows, within a table.

Foreign Key:
A foreign key is the linking pin between two tables.
Given a value from a row in one table you can access another table to find the right row with related data.
So, one table gives the key for the other, 'foreign' table.

Join:
With a join you combine columns from different tables to one big temporary result table. For instance, make an overview of readers, with the name of the newspapers that they are subscribed to.

One to Many Relationship:
Most relations between tables are one-to-many.
Example:
One area can be the habitat of many readers.
One reader can have many subscriptions.
One newspaper can have many subscriptions

RDBMS:
Relational DataBase Management System enables you to implement a database with tables, columns, and indexes. Guarantees the Referential Integrity between rows of various tables. Updates the indexes automatically.
Interprets an SQL query and combines information from various tables.

These are just a few but might help you in your learning experience - Best of Luck with your database design.
websitedatabases is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00


Similar Threads
Thread Thread Starter Forum Replies Last Post
Display mysql table fields and data goldfish PHP Development 6 05-14-2008 03:49 AM
PHP form for entering data to MySQL database vvaldir PHP Development 31 08-26-2006 11:44 AM
Listing mysql data using php kayla Other Programming - Perl, C++, Java, ASP, .NET Development 1 06-26-2005 09:07 PM


» Sponsors

» Links

» Affiliates
Web Hosting
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 03:00 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums