Friday, September 20, 2019
Example Of Primary Key Computer Science Essay
Example Of Primary Key Computer Science Essay Database is a structure that is generally divided in two respects, namely a flat database and a relational database. Relational database easier to understand than the flat database. Because relational database has a simple design and it is easy to do data operations. Database also has a relational structure found in tables to store data. On each table is it consists of columns and rows and a column to define the type of information that should be saved. Basically the database is very useful when the time to retain the information that will be categorized logically. For example, if you want to save the information on the data, the database enterprise or school, it can be in a group with matters in business become more tables. In the database there is some relationship, the relationship is as one to one, many to many, one to many, Primary Key The key is a set of columns that can be used to identify or access a particular row or rows. Identified key explanatory tables, indexes, constraints or reference. The same column can be part of more than one key. A unique key is a key that is constrained so that no two values à ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹are the same. Unique key columns cannot contain NULL valuesà ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹. For example, the column number of employees can be defined as a unique key, because each value in column identifies only one employee. No two employees can have the same number of workers. The mechanism used to enforce uniqueness of the so-called index unique key. Unique index table is a column, or a collection of ordered columns, each of which identifies value (specify function) unique rows. A unique index can contain NULL valuesà ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹. The key is one unique key defined on the table, but was selected as the first important key. There can be only one primary key on the table. A primary index is automatically created for the primary key. The main index used by the database manager for efficient access to table rows, and allows the database manager to enforce the uniqueness of the primary key. (You can also specify non-primary index key columns efficiently access the data when processing the query.) If the table does not have a natural unique key, or if the order of arrival is a method used to distinguish unique rows, use a time stamp as part of the key can help. Example of Primary Key PROJNO (Primary Key) PROJNAME DEPTNO MA2100 Weld Line Automation D01 MA2110 Weld Line Programming D11 Example 1 If each column in the table contains duplicate valuesà ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹, it cannot determine the key with just one column. A key with more than one column is a composite key. The combination of column values à ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹should define a unique entity. If a composite key cannot be easily defined, it can also be considered to create a new column with unique valuesà ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹. EMPNO (Primary Key) PROJNO (Primary Key) ACTNO (Primary Key) EMPTIME EMSTDATE (Primary Key) 000250 AD3112 60 1.0 1982-01-01 000250 AD3112 60 5 1982-02-01 000250 AD3112 70 5 1982-02-01 Foreign Key A foreign key is a field in a table corresponding relationship with the other candidate key table. Foreign keys can be used to cross-reference table. For example, suppose we have two tables, customer that includes all customer data, and the order table that includes all customer orders. Intention here is that all orders must be associated with a client who is in the customer table. To do this, we will place a foreign key in the order table and it relates to the key customer table. Identifying foreign key column or set of columns in a table that refers to a column or set of columns in another table. Column in the table must reference the key pillars or other super key in the referenced table. Value in a reference column line must occur in a single row in the referenced table. Thus, a row in the reference table cannot contain values à ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹that do not exist in the referenced table (except potentially null). In this way a reference can be made to link information together and it is an important part database normalization. Various rows in the table reference may refer to the same row in the referenced table. Most of the time, it reflects a (parent table or reference table) to many (child table, or referencing table) relationship. Example Foreign Key Below is an example of the relationship between the Company and also schedules, Contact. Tables in the company is the parent of a link. In child contact schedule, Field CompanyID the table to show the contact contacted the company owned. The role of the Son (Multiplicity) Diversification foreign key defines how many records in the child table can link to records in the master table. In the above example the childs diversity since a company can have any number of contacts. Example Primary Key Foreign Key Relationship It have a Primary Foreign Key, in this figure it have a relationship between this two keys. e.g. One to One , One to Many , Many to Many. Primary key. This is indicated by the Primary Key field equivalent to the schedule. this shows that the field that identifies a unique record. For example, Product_ID product and ORDER_ID for Order the values à ¢Ã¢â ¬Ã¢â¬ ¹Ã ¢Ã¢â ¬Ã¢â¬ ¹that are normally produced by the field is Auto-rise. they do not have any intrinsic meaning and only integers are automatically generated one by one. Primary Key and Foreign Keys. This indicated that the PF with the field in the table. In this case, the field is also created as a key example of this attitude in the Schedule of Key, Primary Key in Table Customer_Orders_Products is a composite key, consisting of two fields. The product_id is the Primary Key in the table Products, and ORDER_ID is the Primary Key in the table Customer_Orders. One-to-Many Relationship. One-to-Many very common in the real world, and it is very easy to read that A Parents can have a lot of children. In this figure shows that, One Product can be attributed to Customer_Orders_Products the Many. The line between product and Customer_Orders_Products is continuous line (not small dotted lines). This means that the product_id field is the Primary Key in Table Customer_Orders_Products. A dotted line will show the existence of a Foreign Key. Many-to-Many Relationships. Relationship Many-to-Many very important in the real world, and being able to see them all around us every day. For example, many customers may order the same product. Many products can be ordered by the same customer. This is called Relationship Many-to-Many. It can not be implemented directly in the Database Table relationships. The solution is to create an intermediate table that records all the combinations that exist between the Customer and Product. For example, if a customer who ordered three products, then there will be three records for that customer in an intermediate table. Low key combination to be a parent table primary key intermediate in this table. We also need to allow for comments like Make it stronger,. If we get to the right database structure, then it is very easy to extend it. Question 2 Explain the main characteristics and advantages of the following terms. a ) Relational Database b) Object Oriented Database c) Object Relational Database Relational Database Can be connected to a database with a collection of data items is strongly recommended as a set and the name of the Minister of Finance official explained from Any data easily accessible. A database was created using the model relations relationship. The software used in database relations database management system called Relations. A relationship database is the preferred choice in storing data, as compared to other models such as the hierarchical database model or network model. The first database is been commenced in 1970, namely by Edgar Codd. Advantages of Relational Database Avoid Error There is only a single storage location for any piece of information, so: data update is easy without having to change the same information in 15 different files. info is always up to date there is no chance of remaining old data in some forgotten file. Number and date: no typos such as 10, 10, 10, not 10. avoid problems such as data type in Excel dreaded syndrome. avoid unwanted text-to-date conversion like November 12 to be November 12 1900. Error checking data as they are entered: validated data on data entry, to filter the impossible data can be cross-checked against existing information. Manipulate Data With databases it can combine different data easily. No more error-prone cut-and-paste to force data into different formats. Do away with all intermediate Excel spreadsheet that is often generated when manipulating data. (And which you often darent delete just in case they contain important information.) Data manipulation is done by using a query. This means Structured Query Language, SQL, to merge, update and manage data, but most users do not need to know any SQL to perform complex tasks. In Microsoft Access, for example, Visual Query Builder provides a simple, intuitive interface makes most queries. Visualize Data A database is being adjusted can reveal new areas for investigation to present large quantities of data in an intuitive form. Often the patterns become apparent only by flicking through data. With this special database it is possible in new ways: data from many different sources can be brought together and displayed quickly and and fast. Integrate with analysis Ends with an Excel file to a multi-analysis, each subtlety different? Never sure that the correct file is not delete any, just in case. With a relational database, this is the dilemma of the past. Your data set for analysis is created using queries stored in the database. No copy is made of data, but instead you link to query directly from the statistics. Object Oriented Database Reduced Maintenance The main goal of the object-oriented development is a guarantee that the system will enjoy a longer life while having maintenance costs much less. This is because most of the processes in the system contained, behavior that can be reused and will be included in the most recent behavior. The ultimate goal is for the new object-oriented development Real World Modeling Objects operational system is very prone to model the real world in a more complete fashion than do traditional methods. Objects that have been organized into a class of objects, object-related behaviors. Based on the object, rather than on data and processing only Improved Reliability and Flexibility Object-oriented system to be far more reliable than traditional systems, especially in the new behavior can be built from existing objects. Because objects can be dynamically called and accessible, new objects can be created at any time. New objects can inherit data attributes from one, or many other objects. Behavior that can be inherited from the super-class, and novel behavior can be added without performing the functions of the existing system. Object Relational Database Database Object capabilities can be expanded with additional ties and new data types, access methods and functions available in object oriented programming. it can add character string with alpha-numeric data types. Complex data types can combine features of data types that already exist in the database. here it is able to determine the data type of text containing desired time or with the number of bytes used to create user defined data types can be opaque or own. it can also add user-defined virtual processors. Encapsulation By using encapsulation of database object you want to contact in the form of a table. For example, Table 1 includes the name, address, phone number and email address for contact. Through class encapsulating Contacts, it just combines all this information in a table on this one. So when you query the database for this information, you generate a report in a style designed to include all of this information. Appendix PROJNO (Primary Key) PROJNAME DEPTNO MA2100 Weld Line Automation D01 MA2110 Weld Line Programming D11 EMPNO (Primary Key) PROJNO (Primary Key) ACTNO (Primary Key) EMPTIME EMSTDATE (Primary Key) 000250 AD3112 60 1.0 1982-01-01 000250 AD3112 60 5 1982-02-01 000250 AD3112 70 5 1982-02-01
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.