Referential integrity constrain in DBMS

Tags:
DBMS
I need explanation in view and referential integrity constrain in DBMS. Can someone help me?


Software/Hardware used:
what is view ?why we are using ?where we are implement? different between view and referential integrity constrain?
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

In DBMS, view refers to the result set of the stored query on the data. The view can contain anything, including numeric or string articles, so long as the column permits it. In addition, a view is just a virtual table with no physical presence on the drive. A referential integrity constraint refers to the foreign key column in a table. Every value in the the foreign key column will be found in the primary key of the table unless there is an option for “null.” Many coding experts consider the referential integrity constraint to be the most important type of restraint imposed upon relational databases.

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • AshishSingh10
    Hi,

    The theory of referential integrity says that a foreign key declared in any relational database can contain either a null value or can hold values from parent table's primary key or candidate key.

    A sample code: -

    Schema creation script for the Orders and OrderDetails tables

    CREATE TABLE Orders(
    OrderID    int NOT  NULL,
    CustomerID char(5)  NOT NULL,
    OrderDate  datetime NOT NULL,
    CONSTRAINT PK_Orders_OrderID PRIMARY KEY(Orderid))
    
    CREATE TABLE OrderDetails(
    OrderID  int NOT NULL,
    PartID   int NOT NULL,
    Quantity int NOT NULL,
    CONSTRAINT PK_OrderDetails_OrderID_partid PRIMARY KEY(OrderID, PartID))
    
    INSERT INTO Orders VALUES(10001, 'FRODO', '19990417')
    INSERT INTO Orders VALUES(10002, 'GNDLF', '19990418')
    INSERT INTO Orders VALUES(10003, 'BILBO', '19990419')
    
    INSERT INTO OrderDetails VALUES(10001, 11, 12)
    INSERT INTO OrderDetails VALUES(10001, 42, 10)
    INSERT INTO OrderDetails VALUES(10001, 72, 5)
    INSERT INTO OrderDetails VALUES(10002, 14, 9)
    INSERT INTO OrderDetails VALUES(10002, 51, 40)
    INSERT INTO OrderDetails VALUES(10003, 41, 10)
    INSERT INTO OrderDetails VALUES(10003, 61, 35)
    INSERT INTO OrderDetails VALUES(10003, 65, 15)

    1,330 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: