Database Introduction
From SwinBrain
This page covers a quick introduction to databases, examining what a database is, why they are used, and ways of using them.
What is a database?
Before we answer this question lets consider a typical business application. This application will have associated with it a large amount of data, for example the details of the products that the company sells. This data need to be managed so that it can be used by the company. Consider the company's product details, this information would be needed on the company's web site if they want customers to be able to view this. A database is a collection of data managed in a systematic way, in this case the data refers to product information. Typically this information is stored in records, where one record would represent one product in this case. This makes the database much like a file, containing details that can then be manipulated by a program.
| Product Table | ||
| Product Code | Name | Cost |
| W123-a | Widget type 3 | $0.25 |
| C156-e | Large cog | $5.40 |
| W871 | Small Widget type 7 | $0.05 |
| ... | ... | ... |
Want to play around with your own database? Check out this how-to document.
- MySQL a free open source DBMS
- Microsoft Access a small DBMS included in Office
- Oracle, a large commercial DBMS
- SQL Server, Microsoft's DBMS
- DB2, IBM's DBMS
Relational Databases
There are different ways of potentially managing data within a database. The most common form of database is the relational database. A relational database organises information in tables, where each table contains a number of rows (the records). Each row in a table can store a number of values in fields, where each field stores a single value. Looking at the Product Table above the entire thing illustrates a table, each row represents an individual product or record, and the individual values are stored in field within that record. Each record in this table has three fields, a Product Code field, a Name field, and a Cost field. A relational database stores data values in the tables, and can also define relationships between records, and data constraints.
Creating your own database involves defining the tables that it will contain, and the columns within the tables. The columns provide the fields for each row in the table. When specifying each column, you would define its name such as Product Code or Cost, and indicate the type of data stored there. For example the third column in the Product Table is called Cost and stores Currency values. The following table lists some of the different data types available in Microsoft Access.
| Data Type | Description |
| Text | Can be used to store textual information of up to 255 characters |
| Memo | Use this if you want the field to store more than 255 characters, a memo can store up to 64,000 characters |
| Number | This is used to store numeric data (numbers) |
| Date/Time | Is used to stores Dates and Times |
| Currency | This stores currency values, while this is numeric data precision is more important so it is stored differently to ensure that it is accurate. |
| AutoNumber | Used to create a automatic identifier for each row. The number is incremented by one for each new row (0, 1, 2, etc.) |
| Yes/No | Used to store values that are True/False, Yes/No, On/Off, etc. |
Links
These links will provide you with starting points for examining details about databases.
- Database Relationship Introduction covers linking multiple tables together with relationships
- SQL Commands Introduction provides a basis for how to interact with a database
- Database Management Systems Introduction outlines some of the differences between DBMSs and how to select the right one for a project.
Here are some external links that build on this further.
- For further details on what a database is consult the Database page on Wikipedia.
- Relational model on Wikipedia discusses the basis of the relational model
- MySQL a free open source DBMS
- Microsoft Access a small DBMS included in Office
- Oracle, a large commercial DBMS
- SQL Server, Microsoft's DBMS
- DB2, IBM's DBMS