Increased demand for user interaction and custom Web experiences has caused the popularity of relational databases to skyrocket. Relational databases, in essence, are a set of tables that store related information. One table in a database might contain user account information, another might contain payment and shipping information and yet another might contain a list of product orders. By storing all of these things together, data can be processed in a highly accessible manner.
Data accessibility is the key purpose of modern relational databases. Through the use of query languages, a command can be structured to pull up any information you want. Most query languages also have various functions built into them, allowing for data to be processed before it even leaves the database. Some even allow for stored procedures and other custom functions to be written. Data retrieved from a relational database is likely intended to undergo some degree of processing by an application before it is displayed to the end user. Stored procedures and other functions allow for intensive data processing to occur before it even leaves the database, often reducing overhead.
Primary and Foreign Keys
A primary key is a column in a table which uniquely identifies a record. Without this, there wouldn&#039;t always be a way to guarantee a single record gets pulled up when desired. If you wanted to write a program to allow a doctor to modify his patient&#039;s medical records and he had two patients named John Smith, lack of a primary key would present a problem.
Foreign keys, on the other hand, provide a reference from one table to another. This allows rows to be associated. You might take a user&#039;s primary key, for instance, and use it as a foreign key to associate purchases with their account. Each purchase would still have its own primary key to distinguish it from other purchases by the same user.
A trigger is essentially a stored procedure which is activated by a database query. It can be performed either before or after the query is executed. An example of this would be in deleting a user from the system. Things such as the user&#039;s billing information might be stored in a separate table, but are no longer necessary. A trigger could be created to ensure related information is removed when a user&#039;s entry is deleted from a single table. Database integrity is maintained this way, ensuring applications do not break when they try to perform certain tasks.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for