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.
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.