Introduction Of Primary Keys And Foreign Keys Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Primary keys uniquely represent each record in a data table field or field combo. Is a primary key to uniquely identify each record of a table, but this is only part of its role, the primary key of the main role is to record and associated data that is stored in other tables. In this sense, the primary key is a different simple pointer between records in a table. Therefore, the primary key values are meaningless to the user, and it is to contact the assigned value is also nothing special. Foreign key is a constraint the following property ID in this table the ID attribute of the person table and delete cascade when data is deleted in the person table. This table exists in the person of ID attributes in the table rows will be deleted, and maintain a database of consistent information.

Primary keys in database

Primary key is selected for table of candidate keywords that uniquely identifies the row. Primary key contain a one table only. And then, primary keys can be represented by a field, can also be used by more than one field, and became the single-field primary key or a multiple-field primary key. And it uniquely identifies a row of data in the table or you can uniquely identify an entity. Besides that, primary keys also have many useful in database. Such as guarantee of entity integrity, speeds up database operations, and other. Most useful primary key in database is when you add a new record to a table, ACCESS will automatically check for new record's primary key value does not allow that value to other record's primary key value duplicate. And then, ACCESS automatically displays records in a table in order by primary key values. If you do not define a primary key, pressing the Enter record shows the order of records in a table. Furthermore, primary keys should be guided by the principle that. Primary keys should not be meaningful to users. If a user sees a join table that represents a many to many relationship in the data, and complain that it doesn't help, it justifies its primary key to good design. Next, never update primary keys. In fact, because in addition to the primary key uniquely identifies a row, has no other purpose, so there is no reason to update to it. If a primary key needs to be updated, then the primary key user does not have the significance of the principle being violated. Primary key should not contain dynamic data, such as time stamp, date created, or modified, and other.

Primary keys should be automatically generated by the computer. If intervention by the people to create primary key, would have significance other than it takes in addition to uniquely identify a row. Once crossed this boundary, it is possible to think the motive for modifying a primary key, so that such systems used to link records, key means of managing records will fall into the hands of people who do not understand database design. At last, primary key also have some characteristic such as a table can have only one primary key. If established in other fields on the primary key, old primary key will cancel. Although the primary key is not required, but it is best to set a primary key for each table in ACCESS.

Foreign keys in database

If the public key is a primary key in a relationship, then this public key is called a foreign key of another relationship. Thus, linkages between the foreign key relationship between the two. Relationship to another table that the foreign key as a primary key is called primary tables, tables that have a foreign key from the table is called the primary table. Foreign key is also called a foreign key. In other words, if a property set is not in the relational model R primary keys, but a second primary key for the relation R1 to the property set is a foreign key to the relational model R, usually abbreviated FK in the database design. Then, the uses of foreign keys are maintaining data consistency, integrity; the main purpose is to control the storage of data in the foreign key table. Make the two tables to form associations, the foreign key can reference only columns in the appearance of the value or null. Besides that, building the foreign key also has some ways like create a foreign key for the associated field. Then, all keys must be unique. At last, avoid the use of a compound key and the associated foreign key is always unique key field.

How theses keys use in a database system

Structure is the key, as its name implies, a key part of a relational database and essential part of the table. They ensure that can uniquely identify each record in a table or a combination of fields in the table. They help to implement integrity and to help determine the relationships between tables. There are three main types of keys, the candidate keys, primary keys, and foreign keys. There is also an alternate key or secondary key, can be used, as shown in the name, as the key to primary key secondary or alternative.


First name

Last name














The primary key field (s) (a primary key can be from more than one field) that uniquely identifies each record, only the student for each record, never going to duplicate key values in the same table, and so on using the student ID field in table. Constraint is a rule that defines what data is valid for a given field. Therefore, the primary key constraint is a primary key field is not empty, the rules and does not contain duplicate data.


Primary key and foreign key are many advantages in database. Such as all other candidate key is a unique key it is functionally dependent on. Besides that, foreign key also have some advantage such as allows referencing uses the primary key of another table to another table.

Question 2

Introduction to relational database, object oriented database, object relational database

Relational database is a collection of data items organized as a set of formally described tables from which data can be accessed easily. Then, object oriented database is a form used in the object database management system for information of object-oriented programming. Last, the object relational data is a database management system similar to thee relational database, there is an object-oriented database model: objects, database schemas and in the query language, direct support for classes and inheritance.

The main characteristic and advantage of relational database

Relational database collection, and cross reference data stored in the table. Companies can use this table to save information about the products and customers. IBM relational database created in 1970 by E.F.Codd. Database table contains a column and row information and logical relationships, and constraints. Then, relational database is a two-dimensional table composed of a relational database. A table contains a value in a set of columns and rows. Each column contains a data type (numeric, Alpha, binary) and therefore accepts only data of type, you can execute the rule or constraint is enter. Each row in the table represents one fact in business. Such as, a heading in the table to the customers table, customers can be expressed as: column 1-name, column 2-name, column 3-the customer ID, column 4-the date of birth. Using this combination of information, data will always represent a unique line of customers. Connect relationships together several tables in a database. These relationships are expressed by the key ID is unique or data such as column 3 customers. No two custom have the same customer ID, but may be have the same name. Address table may contain their address information. If the client ID is the address table, and then can joins two tables by using the customer ID, you can with the right customers at the right address. The customer ID is the primary key in the customers table, but it is a primary key in address list because it just in order to keep the relationship between the two tables. Relational database also have referential integrity. Referential integrity is used in relationship to keep them consistent rules. Referential integrity, primary keys and foreign keys from both tables, will join each table must contain data in the rows of the tables joined together. No purpose in the customer ID is the address table, if there is no more data on one line, in addition to the customer ID. Advantages of relational databases are can to minimize errors in several ways. Such as there is only one piece of information, a single storage location. If simple data updates, then no need changes to the same information in 15 different files. No typographical errors, such as organizing Committee, I0, l0, instead of 10. Besides that, also can avoid the terrible Excel data type issues like "digital text" syndrome. Can avoid unwanted text to date conversion as "MAR03" on March 3, 1900. And then, relational database also can combine different datasets easily and efficiently. Such as no more error-prone cut and paste to force data in different formats. Abandon all intermediate operations data is typically generated when the Excel spreadsheet. Use queries to perform data operations. These use SQL structured query language combinations, updating, and managing data, but often users do not need to know any of the SQL to perform complex tasks. In Microsoft Access, for example, a Visual Query Builder provides an intuitive interface, the majority of queries easier. Other important advantages of relational databases are including the performance, power, and flexibility to new hardware technical support and capacity to meet the needs of all types of data. Relational databases also have scalability, and provide support for the implementation of distributed systems.



Characteristics and advantage of object oriented database

When the capacity of the database and object-oriented database language features when combined, the result is an object-oriented database management system (oriented). Allows object-oriented database-oriented product development, targeted them, store and copy or modify existing objects, or to make a new object-oriented. Because the database is integrated with programming languages, programmers can maintain consistency in an environment, which will use the same model and programming language-oriented representation. Relational DBMS project, in contrast, maintain a database model and a clear division of labor between the applications. With intranet and extranet implementation of Web-based technology to increase usage, companies have a vested interest to reveal its complex data-oriented. Using data that has been stored because the objects to those companies or organizations for multimedia presentations using computer-aided design (CAD). This is advantages of DBMS specially designed. Some of the object-oriented database design object-oriented database languages like Visual Basic.NET, C++, objective-c and Smalltalk; have their own other database languages. Object oriented database use exactly the same model as an object-oriented programming language. An advantage of Object-oriented database is flexibility and simplicity to create a database: from the view of software development, database programming and user interface is flexible, friendly. Currently in most RDDMS products use standard query language SQL, and allow users to access information on almost no difference to another product to a product. Application and relational database software interface has a similar program, access mechanisms, provides a large number of standard data access methods. Second advantage is simple in structure: from data modeling, prospect has a fairly simple structure of a relational database (), provides a more complex view, for a user or a program. Database design and normalization process is simple and easy to understand. Powerful relational database, extensive functions, has effectively supports a number of database application.



Characteristics and advantage of object relational database

Object relational database is an object relational database management system (ORDBMS) is a database management system with that is similar to a relational database, except that it has an object-oriented database model. This system supports the objects, classes and inheritance in database schemas and query language. Object-relational database to provide the middle ground between relational and object-oriented databases. Research on spatiotemporal indexing mechanism to manipulate the data in a query by using the query language. Conceptual data modeling, entity-relationship diagram of the system and use the class and the gap between the inheritances of object-relational mapping technologies. Object oriented database also supports the extended data model with custom data types and methods. This allows developers to improve the levels of abstraction in which to view the problem domain. Advantages of object relational database are added a new data type, access methods, and find the function in object-oriented programming extension object relational database capabilities. You can use the add data types to a string of alphanumeric characters. Complex data types can be combined characteristics of the data type already exists in the database. The text that you want to include, or the number of bytes used to create it, you can specify the data type. User-defined data types can be opaque or have their own characteristics. You can also add user-defined virtual processors. Besides that, Object-relational database management system can be used to generate the database. You can attach them to your company Web site, allows for such items as your inventory records updated. When users click programming, control buttons to connect to the database management system under one of the order, the objects used by the components on your site can make the updates. Last, the object relational database also is a polymorphism. Polymorphism in object-relational database involves allowing one operator has different meanings, within the same database. By establishing a relationship, can join your table within your database. This includes all records that might contain the same name but with a different message. Joe Doe, for example, if there is a record, but some are insurance claims and accident reports. Operated you can join table name when you query that database records; it contains all records for Joe Doe.




Relational database, object oriented database, object relational database most useful in database management. User can use this to save their resource more clearly and fast. Such as relational databases can include the performance, power, and flexibility to new hardware technical support and capacity to meet the needs of all types of data, Object-oriented database is flexibility and simplicity to create a database, and object relational database added a new data type, access methods, and find the function in object-oriented programming extension object relational database capabilities. So, these have many helpful in database management.

APPENDIX (N.D)[ONLINE] available at: (N.D)[ONLINE] available at: (N.D)[ONLINE] available at: