What is integrity and what is constraint??Explain with
example
Answer / Jagrit Kashyap
Integrity in the context of databases refers to maintaining the consistency, accuracy, and reliability of data. It ensures that the data remains valid and trustworthy throughout its life cycle. Integrity can be enforced through various constraints.
A database constraint is a rule or condition that restricts the possible values that can be stored in one or more columns of a table to ensure data consistency. There are several types of database constraints:
1. Entity Integrity (Primary Key): ensures that each row in a table has a unique value for its primary key column(s). For example, in an Employees table, the employee_id column should have unique values to maintain entity integrity.
2. Domain Integrity (Check Constraint): enforces a specific range or set of allowed values for a column. For example, a salary column might have a domain constraint that only allows positive numbers.
3. Referential Integrity (Foreign Key): ensures the relationships between tables are maintained by linking columns in one table to columns in another. For instance, an Orders table may have a foreign key referencing the customer_id column in the Customers table.
| Is This Answer Correct ? | 0 Yes | 0 No |
How can you use check constraints for self referential integrity?
What is the purpose of a cluster?
What is hot backup and logical backup?
Explain about achiever in sql?
How to create a stored function in oracle?
What is Hash Index?
What is a database schema in oracle?
Display Odd/ Even number of records?
How to define a sub function?
What is a database table in oracle?
Can a field be used in a report without it appearing in any data group ?
What is the difference between count (*), count (expression), count (distinct expression)?