Databases have become so important in industrial societies that they can be found in almost every field of information. Government, military, and industrial databases are often highly restricted, and professional databases are usually of limited interest. A wide range of commercial, governmental, and nonprofit databases are available to the general public, however, and may be used by anyone who owns or has access to the equipment that they require.
B). Tables
A table (a relation) is a collection of data about a specific topic, such as ‘Books’, ‘Borrowed Books’, ‘Employees’, ‘Incoming Books’, ‘Members’, ‘Outdated Books’, and ‘Reservations’. A table contains rows which contain data of a particular object and columns which contain data of a specific type. Using a separate table for each topic means that you store that data only once. This results in a more efficient database and fewer data-entry errors. Most tables will have some relationship to other tables. For example the ‘Book’ table likely has a ‘Book ID’ column in which it keeps track of the book number; ‘Book ID‘also appears in the ‘Member’ table. Assuming that ‘Book ID’ is a unique identifier, or primary key, of the book table, a foreign key relationship is established by which the book and member tables can subsequently be joined.
The following table is the ‘Book’ table in the library database which contains data about books.
C). Attributes (Columns)
In a table, data is arranged into columns. A column is a vertical section in a table that includes data of a particular entity. When columns are created in tables, names are given to them for identification of there purpose. This indicates the type of information that is stored. The user can specify additional properties and other column properties can include whether the column is the table's primary key or whether users must enter a value into it or specify the default value of it. Even after specifying the properties of the column the properties could be edited as wished by the user at anytime. Tables can also have a designated single attribute or a set of attributes that can act as a "key", which can be used to uniquely identify each tuple in the table. For example the columns enumerate (list) values of various attributes the columns of a table. For example in the ‘Member’ table in the library database enumerates ‘Member ID’s, ‘Member Name’s, Addresses, ‘Phone Number’s, etc…
D). Tuples (Rows)
A tuple is also known as a record. A tuple contains a complete set of information in a DBMS. In other words it could be said as a section of inter related fields. A record is a set of fields, each field which contains one item of information. A set of records constitutes a table. For example, the ‘Employee’ table in the library database contains records that have fields such as ‘Employee ID’, ‘Employee Name’, ‘Employee Address’, ‘Phone Number’, ‘Holding Position’ and ‘Salary’. As a result, each tuple of the Employee table represents various attributes of a single employee. There can't be identical tuples or rows in a table. And each tuple will contain a single value for each of its attributes.
E). Primary Key
One of the most important things in a relational database is that every row in a table should distinguish in some way from every other row in that table. Usually one column in a table is assigned as a unique identifier in order to distinguish the rows. One or more columns which are assigned as unique identifiers are known as a primary key. Each table can only have one primary key. For example the ‘Book’ table has a unique identifier called ‘Book ID’; one book can have only one Book ID no matter how many books of the same name remain in the library. If there are two or more book names in the library which has the same name but different authors, two separate Book IDs have to be used.
F). Composite Primary Key
Tables might also have multiple unique identifiers, but each table can have only one primary key. A combination of all columns in a table can be this unique identifier, but the identifier is usually at most the combination of a handful of columns. A composite primary key is a combination of two or more columns that act as a unique identifier for a table. For example the library database has two tables with composite primary keys. One table, Incoming Books holds the data of the books which will be available in the library recently. There can be two book names with the same title but the authors are different, in this case we have to use a composite primary key to distinguish the incoming books.
G). Foreign Keys
Foreign keys are established in order to make relations between two specified tables. A foreign key works in conjunction with primary key to make relations among specified tables. For example, you can place a foreign key on the ‘Book ID’ column in the ‘Outdated Books’ table to ensure that a value entered in that column matches an existing value in the ‘Book ID’ column of the Book table. Usually a foreign key is not a primary key; in this case, in the ‘Outdated Books’ table ‘Book ID ‘should be a primary key in order to avoid the same ‘Book ID’ entered twice.
In relational database diagrams, a foreign key is automatically placed on specified columns when you create a relationship to a table from another table to which a primary key is attached. The following is a relational database diagram which shows how a foreign key is connected to a primary key.
The following picture shows how the values entered in the outdated book table matches the books in Book table.
References