What is the difference between a database and a table? Why are entity integrity and referential integrity important in a database?
Difference between database and a table:
A table is an object inside a database. A database has tables of data, views, indexes and programs. A database can have 10 or thousands of tables.
More specifically, a table is a collection (rows) of data on a single related topic. For example, the Employees table would have employee data, each row being a different employee, but it would not have Inventory data. That would be in the Inventory table.
A database is a collection of objects, primarily tables, but also indexes to help search the tables, views that filter, select and combine the data in the tables, and stored procedures (pre-defined programs that perform specific actions on the database).
Importance of entity integrity and referential integrity in database:
Data corruption and inefficiency have drastically affected companies and firms proving its maintenance procedures to be costly, difficult and time consuming. The concept of data integrity thus evolved, conveying the precision and consistency of the data over processes for its entire life cycle. These include processes for instance updates, transfer, storage or retrieval of data. In much simpler terms the relationship a piece of data has with other data is also known as data integrity.
Moreover, it is enforced when a database is at its designing stage by a set of rules which is consistently applied to all the data being entered in the database. These rules check for errors and validate data to maintain its precision and usefulness. The important rules through which data is validated are named as integrity constraints. The forms of data integrity constraints which are of utmost importance are entity integrity and referential integrity.
Entity integrity is a prominent aspect of data integrity. It is an integrity rule which is maintained through the core concept of the primary key, which ensures that there are no replica records inside the row thus. Furthermore it emphasizes that a unique column or columns should be chosen to be a primary key and it restricts it to be duplicate and null. In addition to this, the system maintains entity integrity by not allowing operations such as insert and update that could produce an invalid primary key. Ensuring every student’s id in the students table to be unique is an example of entity integrity.
The other type of data integrity constraint is termed as referential integrity. According to Blaha (2005) “referential integrity is a database constraint that ensures that references between data are indeed valid and intact. Referential integrity is a fundamental principle of database theory and arises from the notion that a database should not only store data, but should actively seek to ensure its quality.” Moreover referential integrity in context to a relational database concerns with the relationships between two tables. The concept of referential integrity is maintained through the combined concept of primary key and foreign key. This states that for a referential integrity to be enforced a foreign key should contain values from a parent table’s primary key field.
Entity integrity and referential integrity both play a crucial role in any proper database design. As entity integrity ensures the accessibility and successful search for a present row, as well as it prevents data conflict between the rows. Furthermore any failure in searching the row will indicate that the row has no existence in the table. On the other hand, referential integrity is important because its presence ensures that assigning a non existing foreign key to a table would be impossible. Moreover, a further example for importance of referential integrity could be depicted by the instance of an insurance agent and customer table. The referential integrity enforcement in an insurance agent is assigned to a customer relationship means that it will be impossible to assign a non existing insurance agent to a customer. In addition to this, integrity could also be
portrayed in the example of a store database. Whereby, customer id is the primary key and customer id in the invoice table is the foreign key. If one wants to delete customer record, all the other records such as invoices have to be deleted first.
Lastly it could be said that the integrity constraints have obvious beneficial significance. As it improves data quality by reducing data redundancy and inconsistencies thus to maintain data accuracy and reliability, integrity constraints should be properly incorporated at a design level.
Define BCNF. How does it differ from 3NF? Why is it considered stronger than 3NF?
What do you mean by ‘Ternary Relationship’? Define the concept of aggregation with suitable example.
Explain how to reduce a relationship set of an E-R diagram into relational schema.
Write short notes on:
What is the Modularity of a Software System ?
Write a C program to find a number is AMSTRONG or NOT.
Explain the concept of frequency reuse in cellular systems.
Explain two-phase locking protocol.