Create Your Own Database Using Only Notepad : CDV
You have probably come across many instances in which you could have used a database but
didn't want to go through the trouble to setup and learn a full powered database application
like Access or SQL Server. In this series of articles, I'm going to show you how to create a
database using only Windows notepad along with Internet Explorer. You won't believe how
simple and powerful this method is.
The database we design will have powerful features that let you browse, search, sort, and
display the data as a table with any number of rows. You will be able to use the database
on your personal computer, or place the database on your website for your visitors to use.
You can create a database to organize your DVD collection, your checkbook, personal contacts
or club members, or for many other purposes. For this example, we will create a database to
track your ebay auctions. If you don't have any ebay auctions, don't worry. The database can
easily be customized for any type of database you have in mind.
The method I describe can be interfaced to Access, SQL Server, or MySQL if you like. But for
this example, I will show you how to create a database using Windows Notepad, and how to use
Internet Explorer to browse, search, sort, and display the data as a table with any number of rows.
The database that we create using Notepad will consist of comma delimited values (CDV). In other
words, we will use commas to separate the data fields in the file. The downside to using a CDV
Notepad database is that, although you can use Internet Explorer to browse, search, and sort the
database, you can only edit the database in Notepad. Of course, this is perfect if you want
to put a read-only database on your website.
A Brief Introduction to Databases
There are basically two different kinds of databases; flat and relational. Flat databases consist
of a table. The rows of the table are called "records". Each record contains several "fields",
or to put it another way, the columns of the table are called "fields".
Each record in a database should be unique. It doesn't make any sense to have two records
that are exactly the same. To make sure each record is unique, usually one field of each
record is a unique ID number. That field is called the "key".
A relational database consists of several tables. One field in a record "points to" a record
in another table. For example, a field named "address" in one table would point to a record
in another table that actually contains the name, street, city, zip, and country fields of
the address. This is called a "relation".
The value in the "address" field might, for example, be "AKNEY INDUSTRIES". Maybe AKNEY
INDUSTRIES supplies you with thousands of different parts. Rather than repeating the same name,
street, city, zip, and country fields in the record for each part supplied by AKNEY INDUSTRIES,
the relational database has a relation to another table containing the address.
This eliminates all the repeated data sometimes found in a flat database. For example, in a
flat database, if AKNEY INDUSTRIES changed their address, you would have go through the parts
database and change the address in every record of every part that comes from AKNEY INDUSTRIES.
Not too cool.
The database we will create for this example will be a flat database. So the purpose of this
brief introduction to databases is to advise you that if you need a relational database, this
will not be the optimal implementaion.
Creating the CDV Database
To create the database, we first need to determine what fields we need in each record. Below
is a list of the field names and their descriptions.
|Item||A unique ID number|
|Desc||A Description of the item|
|Cost||What you paid for the item|
|ShipP||The shipping charge you paid to receive the item|
|Sale||The sales price you received for the item|
|ShipR||The amount you received to ship the item|
|ShipC||The amount you actually paid to ship the item|