|
When there are a huge number of alternative ways to store data, why should you trouble yourself creating a database? What advantages does a database hold? The main advantage is fast and efficient data retrieval. A database helps you to organize your data in alogical manner. Database management systems are fine-tuned to rapidly retrieve the data you want in the way you want it. Databases also enable you to break data into specific parts. Retrieving data from a database is called querying. You’ll often see the term SQL query, which briefly means any SQL code that
extracts data from the database. Relational databases have the further advantage of allowing you to specify how different data relates to
each other, as you saw in the car sales database example. If you store sales details and salesperson data
in related databases, the question “How many cars has salesperson X sold in January?” becomes very
easy to answer. If you just shoved all the information into a large text file, you’d find it one enormous
task to question, or query, the data and find out specific answers.
Databases also allow you to set up rules that ensure that data remains consistent when you add, update,
or delete data. Imagine that your imaginary car sales company has two salespeople named Julie Smith.
You can set up a database to ensure that each salesperson has a unique ID, called a unique identifier (so
that the Julies don’t get mixed up); otherwise, telling who sold which cars would prove impossible.
Other data storage systems, such as text files or spreadsheets, don’t have these sorts of checks and quite
happily allow you to store erroneous data. For example, you might specify that an employee’s social security
number must be unique in the database. Or if a car is sold and it’s listed as being sold by the employee
with an ID of 123, you might add a check to see that full details of employee 123 are held in one of the
database tables.
A properly set-up database minimizes data redundancy. Again using the car sales example, you can
store all the details of a salesperson just once in the database and then use a unique ID to identify each
salesperson. When you have other data that relates to a particular salesperson (for example, which cars
they’ve sold), you can use the unique ID to search for the data. The unique ID is often a number that
takes up less storage space than the person’s full name.
Databases store raw data—just the facts, so to speak, and no intelligence. A car sales database might
contain the make, model, and price of each car, but you wouldn’t normally store the average number of
cars sold in a month, because you can calculate that from the car sales information, the raw data.
A spreadsheet, however, may contain processed data, such as averages and statistical analysis. A
database simply stores the data and generally leaves data processing to a front-end program, or the
interface the user sees. Examples of front-end programs include a Web page that draws its data from
a database or a program that hooks into the database’s data and allows the user to view it.
Sharing data is also much easier using a database. You can share data among a number of users on the
same computer or among users on different computers linked via a network or the Internet. If the example
car sales company has branches in New York, Washington, and Boston, you could set up a computer
containing a database in one location that is accessible by all of the offices via a network. This is not only
possible but also safe because databases have a clearly defined structure and also enforce rules that protect
the data contained. They also allow more than one person to access the database at the same time
and change the data stored; the database management system handles simultaneous changes. Imagine
the potential chaos if you used an Excel spreadsheet, and two salespeople change data simultaneously.
You want to keep both sets of changes, but whoever saves the spreadsheet last is the person whose
changes are stored, overwriting any earlier changes.
Databases also make sharing data between different systems much easier than using proprietary data
formats—that is, a format specific to a particular program, manufacturer, or operating system. An Excel
spreadsheet, for example, is easily read on a Windows machine with MS Office, but it is more of a challenge
to read on a UNIX, Macintosh, or Linux machine because those computers handle data in a different
way. Even on a Windows machine, you need to have MS Office installed. You can house a database
on a central computer, put the database management system on there, and then enable access via a local
network or the Internet.
As an alternative to databases, text files and spreadsheets have one big advantage, which is also their
weakness: flexibility. Text files have no real rules. You can insert whatever text data you like wherever
you like. To a large extent, spreadsheets are the same. You can ask users to add data in a predefined
structure, but you have no real way to enforce such a request. Using databases limits user access to just
the data and does not allow users to change the structure.
One final significant advantage of databases is security. Most database management systems allow you
to create users in order to specify various levels of security. Before someone accesses the database, he or
she must log on as a specific user. Each user has various rights and limits. Someone who maintains the
database has full ability to edit data, change the database’s structure, add and delete users, and so on.
Other users may only have the ability to view data but not change it, or you may even want to limit
what data they can view. Many database management systems provide a granular level of security, that
is, they are very specific as to what a user can do. They are not just an all-or-nothing approach in which
the user either has access or has no access.
Databases are used pretty much everywhere. Data processing played a big part in the development of
computers, and even today it is one of their main roles. Nearly every walk of life or business requires a
database somewhere along the way. Databases are commonly used on personal computers to store data
used locally, and on company networks databases store and share company-wide information. The
Internet has seen a big rise in databases used to share information; most online shops of a reasonable
size use databases. When you visit online stores of any significant size, a database usually provides all
the information on the goods being sold. Rather than every page being created by hand, large merchants
use a template for book or CD details, and SQL retrieves the book information from the database.
Imagine how much work it’d be if Amazon created every single page by hand!
Databases are great at dealing with large amounts of data that need to be searched, sorted, or regularly
updated. Databases combined with SQL allow you to get the
answers you want in the order you want. |