Relational Databases and Sql - Learn Sql :Series 1

Posted on 16 February 2008 by Praveen

What is a database ?

A Database is a collection of Organized data belonging to some organization or an Organizational process.Say if you are storing your friends contacts and organizing them in some fashion , then you are said to have an contacts database. As Long as you’re collecting and storing the data in an Organized form for a specific purpose , you have got a databse. Mainly we are going to discuss of Operational databases.

Operational databases are the backbone of many companies and Organizations throughout the world today. This type of database is primarily used to collect,store, modify and maintain data on a day-to-day basis. An example of Operational database could be retail stores, Manufacturing companies, Hospitals, clinics and Publishing houses.

Brief history of how relational Database have evolved

The relational database was first conceived in 1969 and has arguably become the most widely used database model in database management today. The father of the relational model, Dr. Edgar F. Codd (1923–2003),was an IBM research scientist in the late 1960s and was at that time looking into new ways to handle large amounts of data.

Dr. Codd formally presented his new relational model in a landmark work titled “A Relational Model of Data for Large Shared Databanks” in June 1970.1 He based his new model on two branches of mathematics—set theory and first-order predicate logic. Indeed, the name of the model itself is derived from the term relation,which is part of set theory

Anatomy of Relational Database

According to the relational model, data in a relational database is stored in relations, which are perceived by the user as tables. Each relation is composed of tuples (records) and attributes (fields).

Tables

Tables are at the heart of any database. Each table should always describe about an single entity or an event qualifying an entity.Every table contains at least one field—known as a primary key—that uniquely identifies each of its records.

table.JPG

Fields

A field is the smallest structure in the database, and it represents a characteristic of the entity of the table to which it belongs. Fields are the structures actually used to store data. The data in these fields can then be retrieved and presented as information in the most required form. Every field in a properly designed database contains one and only one value, and the field name identifies the type of value it stores.

Records

A record represents a unique instance of the entity or an event of a table. A Record is composed of the entire set of fields in a table, regardless of whether or not the fields contain any values. Because of the manner in which a table is defined, each record is identified throughout the database by a unique value in the primary key field of that record.

Keys

Keys are special fields that play very specific roles within a table. The type of key determines its purpose within the table. Although a table might contain several types of keys,we will limit our discussion to the two most important ones: the primary key and the foreign key.

A primary key is a field or group of fields that uniquely identifies each record within a table. (When a primary key is composed of two or more fields, it is known as a composite primary key.) The primary key is the most important for two reasons: Its value identifies a specific record throughout the entire database, and its field identifies a given table throughout the entire database. Primary keys also enforce table-level integrity and help establish relationships with other tables. Every table in your database should have a primary key.

Foreign keys are important not only for the obvious reason that they help establish relationships between pairs of tables but also because they help ensure relationship-level integrity. This means that the records in both tables will always be properly related because the values of a foreign key must be drawn from the values of the primary key to which it refers.

primary-key-foriegn-key.GIF

Leave a Reply