What is Referential Integrity (RI)| Database Management System

what is Referential integrity

what is Referential integrity constraint in DBMS

Referential integrity is a system of rules that a DBMS uses to ensure that relationships between records in related tables are valid and that users don’t accidentally delete or amendment connected knowledge.

You can set referential integrity when the following conditions are below.

The matching Field from the first table may be a primary key or encompasses a distinctive index.

  • The related fields have the same data type.
  • Both tables belong to the same database. If the tables are linked tables, They must be of the same DBMS format, and you must open the database in which they are stored to set referential integrity. Referential integrity can’t be enforced for linked tables from a database in other formats.

Referential integrity Rules

  • You can’t enter a value in the foreign key field of the related table that doesn’t exist in the primary key of the central table. However, you’ll be able to enter a Null price within the foreign key, specifying that the records are unrelated. For Example, you can’t have an order that is assigned a Null value in the customer ID field.
  • You can’t delete a record from a primary table if matching records exist in a related table, For example, you can’t an employee record from the Employees table if there are orders allotted to the worker within the order table.

You can’t change a primary principal value in the central table if that record has a related career. For example, you can’t change an employee’s ID in the  Employees table if there are orders assigned to that employee in the Orders table.

Referential integrity Example

For example, if we tend to delete record variety fifteen in an exceedingly primary table, we want to make sure that there’s no foreign key in any connected table with the worth of fifteen. We should always solely be able to delete a primary key if there are not any associated records. Otherwise, we might find yourself with the associated file.

Read also related article

what is Data Definition Language (DDL)

what is Primary key

what is Foreign key

keys in DBMS

what is my SQL server

Primary key,Candidate key,Alternate key,Foreign key | keys in DBMS

Primary key,Candidate key,Alternate key,Foreign key | keys in DBMS

 keys in DBMS foreign key, Primary key, Candidate key, Alternate key

Keys in a relational model in DBMS -it is essential to be able to specify how rows in a relation are distinguished conceptually, rows are distinct from one another. But from a database perspective, the difference among them must be expressed in terms of their attributes. Keys come here a rescue. We know that information uses tables to arrange info. To keep up knowledge integrity (that is knowledge ought to be correct and in we tend toll formed) we use thought of keys. There are unit 4 varieties of cores in the information that Below describes –foreign key, Primary key, Candidate key, Alternate key.

Foreign key
the primary key in SQL, Candidate key, Alternate key, Foreign key | keys in DBMS

The primary key in SQL (DBMS Primary key)

A primary key is a set of one or more attributes that can uniquely identify tuples within the relation. Within a given link, a collection of one or more attributes having values that sure are unique within a connection. Can uniquely identify that tuple is said to be the primary key in SQL of the relation.

Every relation does have a primary key in SQL.in our sample database. Suppo is the primary key in SQL suppliers as contains a unique value for each tuple in the relation. Similarly, an item is the primary key for a question and the combination of  SuppoNo and detail. No is a primary key for shipments relation.

In some tables, a combination of more than one attribute provides a unique value for each row. In such tables, a group of these attribute declares a primary key; in such cases, the first essential consists of more than one quality; it is called composite-primary-key.

A primary key in SQL is nonredundant; it does not have duplicate value in the same relation. The non-primary-key attributes of a table can refer to as non-key attributes.

 Candidate key in DBMS (Candidate key in SQL)

All attribute combinations inside a relation that can serve as primary key are Candidate keys as they are Candidates for the crucial central position. Occasionally we may encounter a relationship in which there is more than one attribute possessing the unique identification property.

in our sample database, there are two candidate keys suppoNano and Supp-Name in Supplier’s relation. Both of these attributes contain unique values for each tuple.similarly, in items, item no and item-Name are candidate keys.

In the case of two or more candidate keys, only database analyst decides one of them as the primary for the relation.

Alternate key

A Candidate key that is not the primary key is called an Alternate key. In the case of two or more candidate keys, only one of them serves as the primary key in SQL. The rest of them as they are alternates only.

In the supplier’s table, Supp_name is the alternate key, and in items table, item_Name is the alternate key.

Foreign key (foreign key in SQL, foreign key in DBMS)

non-key attribute, whose value derived from the primary key of some other table, is known as foreign-key in the current schedule. A foreign key is used to represent the relationship between two tables. A foreign key in non-key attribute whose value derived from the primary key of another table.or in other words. .a non-key quality of a table, which is the primary key of some other table is known as a foreign key in SQL.

The table in which this non-key attribute the foreign key attribute exists is called a different schedule. Detail table, and table that defines a primary key, which the foreign key in SQL of detail-table refers to, is called Primary table or Master table.

Read also Related article-

 what is MySQL server

Create MySQL database Community Server

what is Data Definition Language (DDL)? 

what is Data Definition Language (DDL)? Definition From


Data Definition Language (DDL)

DefinitionWhat will knowledge Definition Language (DDL)mean?–  An information theme is such as by a group of definitions that are expressed by a special language referred to as a knowledge definition language (DDL). The result of compilation Of DDL statements is a set of tables which are stored in a special file called data dictionary (directory).

whenever data is read or modified in the database system, the data directory is consulted. The DDL provides a group of definitions to specify the storage structure and access strategies utilized by the information system.

Data Definition Language (DDL)  Function

an ideal DDL should perform the following function-

1.it should identify the types of data division such as data item, segment, record, and database-file.

2.it should give a unique name to each data -item,record-type,file-type, database, and other data subdivision.

3.it should specify the proper data types.

4.it should specify how the record types are related to making structures.

5.it may define the type of encoding the program uses in the data items(binary, character, bit, string.etc.) This should not be confused with the encoding employed in physical representation.

6.it may define the length of the data items.

7.it may define the range of values that a data-item can assume.

8.it may specify means of checking for errors in the data.

9.it may specify privacy locks for preventing unauthorized reading or modification of the data.

10.  A logical data definition should not specify addressing, indexing, or searching techniques or specify the placement of data on the storage units, because these topics are in the domain of physical, not logical, organization.

Commonly used DDL in SQL query (Data Definition Language (DDL)

CREATE: This command builds a replacement table and encompasses a predefined syntax. The produce statement syntax is produce TABLE [table name] ([column definitions]) [table parameters]. produce TABLE worker (Employee Id whole number PRIMARY KEY, given name CHAR (50) NULL, family name CHAR (75) NOT NULL).
ALTER: associate degree alter command modifies associate degree existing info table. This command will add up the further column, drop existing columns and even modification the information kind of columns concerned during an info table. associate degree alters command syntax is ALTER object sort object name parameters. ALTER TABLE worker ADD DOB Date.

Read also computer science & technology related article

what is MySQL server

Create MySQL database Community Server

How does a bulb glow?

Web page designing using HTML for website design

What is My SQL Server ||Create MySQL database Community Server

What is my SQL Server


MySQL Database system- The key to a database management system is information management. A database MySQL server is a key to solving the problems of information management.in general, and a server must reliably manage a large amount of data in a multi-user environment so that many users can concurrently access the same data. A database server must also prevent unauthorised access and provided efficient solutions for failure recovery.



MySQL community server refers to the combination of a MySQL server instance and a MySQL database. MySQL server operates using client/server architecture in which a server runs on the machine containing databases and clients connect to the server over a network. The server operating system is usually a Linux 9.0 etc.or windows operating system.



Typically MySQL is supported on window XP, window server  2003, Red Hat Fedora Linux, and Debian Linux, and other. As with any other client/server application, MySQL server is a multi-user database system, meaning several users can access the database simultaneously.



MySQL server



The server (MySQL server) listens for client requests coming on over the network and accesses database contents according to requests and provides that to Client.

Clients are programs that connect to the database MySQL server and issue queries in a pre-specified format.MySQL is compatible with the standards-based SQL (Structured Query Language). The client program may contact the server programmatically (meaning an application call the MySQL server during execution) or manually.


For example, when you are issuing commands over a session to a MySQL server, you are granting the requests to the server by typing commands at your command prompt manually. On the other hand, if you’ve Entered some Info (State your credit card Info Online to the purchase of Several Products ) in a Type is processed with a Host, side Application, Subsequently, MySQL server is contacted programmatically This is often the case in credit card approvals, member subscriptions etc.



MySQL server Features


1.Speed. If the server hardware is optimal, the MySQL server runs very fast. It supports clustered servers for demanding applications.


2.Ease of use. ”MySQL” is a high-performance, relatively simple database system. Form the beginning, MySQL has typically been configured, monitored, and managed from the command line. However, several MySQL graphical interfaces are also available.


3.Cost. My cost is available free of cost. MySQL is a ”open source database. MySQL is part of the LAMP

(Linux,Apache,MySQL,PHP/Perl/Python) Environment, a fast-growing open-source enterprise software stack. More and more companies are using a LAMP as an alternative to expensive proprietary software stacks of its lower cost, reliability, and documentation.


4.Query Language support. ”MySQL server” Understands standards-based SQL (Structure Query Language).


5.Portability.MySQL Provides portability as it has been tested with a broad range of different compilers and can work on many different platforms. It is fully multi-threaded using kernel threads.it can easily use multiple CPUs if they are available.


6.Data types.”MySQL” provides many data types to support different types of data.it also supports fixed-length and variable-length records.


7.Security.”MySQL” offers a privilege and password system that is very flexible and secure, and that allows host-based verification. Passwords are secure because all password traffic is encrypted when you connect to a server.


8.Scalability and Limits.MySQL can handle large databases. Some real-life MySQL database contains 50 million records; some have up to 60,000 tables and about 5,000,000,000, rows.


9.Connectivity.Clients can connect to a MySQL community server using several protocols.


10.Localisation. ”MySQL community server can provide an error message to the client in any language.


11.Clients and Tools. ”MySql server” provides several client and utility programs. These include both command-line programs such as MySQL dump and MYSQL admin and graphical programs such as MySQL Administrator and MySQL Query Browser.MySQL server has built-in support for SQL statements.



Read also the science & technology Related article

what are the basic components of computer system security

Web page designing using HTML for website design

Latest technology trends in Computer technology

Artificial intelligence definition & advantages