Page 11 - Modular_V2.0_SQL_Flipbook
P. 11

Fields: A field represents one related part of a table. It contains same kind of data in a table. For

                    example, age, name, address, designation, and phone are fields in the table given above.
                    Records: A record is a collection of multiple data which is stored in related fields that can be

                    treated as a single unit. It represents the data which is entered in a set of different fields which are
                    related to a particular item. For example, 22, Andy, New Market Lane, Accountant, 9908457245 is
                    one of the records of the table given above.
                 Some other components are also their in the database which are based on the tables. These are as

                 follows:
                    Query: It is just similar to a question and can give you information that you might not be able to

                    find by looking at the table directly.
                    Form: It is used to add, edit and display data from a table in a user-friendly manner.

                    Report: It allows you to organise and present your data in a user-friendly format so that it can
                    be printed. It is used for analysis of patterns and for finding out trends in the data to solve and

                    understand a situation given in hand.

                     KEYS

                 A key is a column or a set of columns that help us to identify records in a table. This column is also
                 known as key field. The key field can also link the data between two or more tables. There are various
                 types of keys in SQL. Some of them are as follows:

                 Primary Key

                 Primary key is a field which is used to uniquely identify records in a database. It is a unique field and it
                 cannot be left blank. There can be only one primary key in a table. If there are more than one primary
                 keys, then there will be two identities against a row, like a student has two roll numbers in a class.

                 There can be only one identity against a row. So, you cannot have more than one primary key. To make
                 retrieval of records faster, Primary keys are indexed in database.
                 For example, in a bank’s master file, the account  is  identified by one account  number.

                 StudentsAdmissionNumber,  AccountNumber,  CustomerNumber and ReceiptNumber are some
                 examples for primary key field.

                 Composite Key

                 Composite key is also called composite primary key. It refers to combination of two or more fields
                 that can uniquely identify or retrieve records. For example, the RollNo and the Project fields in a
                 student table can be used as a Composite key to uniquely identify each record in the table.

                 Foreign Key

                 The main table of a database is referred to as the ‘Master Table’ and the tables in which the related
                 data is stored are called ‘Transaction Table’. The tables are related and linked through a field which

                 is common. This common key field in the transaction table is called the ‘Foreign key’ and its value is
                 related to the primary key values of the master table.

                                                                                                                      9
                                                                                                Introduction to DBMS
   6   7   8   9   10   11   12   13   14   15   16