Home arrow MySQL arrow Page 2 - Speaking SQL (part 1)

Turntables And Records - MySQL

Structured Query Language is the language used to communicatewith databases of all shapes, sizes and varieties. If you're building a Webapplication which needs to communicate with a database, and don't knowwhere to start, this article will get you up to speed on the basics ofcreating tables and inserting data into them.

TABLE OF CONTENTS:
  1. Speaking SQL (part 1)
  2. Turntables And Records
  3. Relationships
  4. Not Your Type?
  5. Changing Things Around
  6. Termination With Extreme Prejudice
  7. Old Data For New
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 7
December 21, 2000

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Every database is composed of one or more "tables" - these tables, which structure data into rows and columns, are what lend organization to the data.

Here's an example of what a typical table looks like:


+-----------+-------+---------+---------+--------------------------+
| member_id | fname | lname   | tel     | email                    |
+-----------+-------+---------+---------+--------------------------+
|         1 | John  | Doe     | 1234567 | jdoe@somewhere.com       |
|         2 | Jane  | Doe     | 8373728 | jane@site.com            |
|         3 | Steve | Klingon | 7449373 | steve@alien-race.com     |
|         4 | Santa | Claus   | 9999999 | santa@the-north-pole.com |
+-----------+-------+---------+---------+--------------------------+

As you can see, a table divides data into rows, with a new entry (or "record") on every row. If you think of a table as a filing cabinet, you'll see that every file in the cabinet corresponds to one row in the table.

The data in each row is further broken down into cells (or "fields"), each of which contains a value for a particular attribute of the data. For example, if you consider the record for the user "Steve Klingon", you'll see that the record is clearly divided into separate fields for phone number, email address, and first and last names.

The rows within a table are not arranged in any particular order - they can be sorted alphabetically, by id, by member name, or by any other criteria you choose to specify. Therefore, it becomes necessary to have some method of identifying a specific record in a table. In the example above, each record is identified by a "member id", which is a number unique to each row or record; this unique field is referred to as the "primary key" for that table.

 
 
>>> More MySQL Articles          >>> More By icarus, (c) Melonfire
 

blog comments powered by Disqus
   

MYSQL ARTICLES

- Xeround Releases Free Version of MySQL Cloud...
- Oracle Announces New MySQL Specialization
- Constant Contact Chooses SkySQL for MySQL Su...
- Revoke Statement in MySQL
- The Grant Statement in MySQL
- SuccessBricks Announces ClearDB Availability...
- Building a PHP ORM: Deploying a Blog
- TROSYS Launches Free MySQL Manager and Admin...
- Building an ORM in PHP: Domain Modeling
- Building an ORM in PHP
- MySQL Leads Open Source Market, Gets Cluster...
- Oracle Announces Milestone Release for MySQL
- How to Stop SQL Injection Attacks
- New Defragmentation Solution for SQL Server
- Comparison of MyISAM and InnoDB MySQL Databa...


© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 8 - Follow our Sitemap

Dev Shed Tutorial Topics: