top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is a Relation Schema and a Relation ?

+1 vote
694 views
What is a Relation Schema and a Relation ?
posted Jan 30, 2014 by Gaurav Sharma

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

2 Answers

0 votes

A relational Schema is simply a representation of your database highlighting the relationships that you have created throughout where as RELATION is the relationship that you build between two or more tables.

Example: Lets say you have a Customer table. In this table you have lots of fields
FirstName, LastName, Address, City, State, PostalCode, StatusID; etc.......

Now StatusID is going to be a numeric value. Lets say that the value is 1. Now you will have a Status Table with multiple fields (ex) StatusID, StatusName, Active, etc.....

Now when you display customer information you will not want to show a StatusID as nobody will know what this is. You will want to show the NAME associated with the status. To do this you will create a releationship between StatusID in the Customer table and StatusID in the Status table. In doing so you will provide for faster lookup results, a constraint that does not permit a numeric value in the StatusID field in the customer table that is NOT in the StatusID field of the Status table.

THEN... To show correct Results you would write a query something like:

SELECT FirstName, LastName, Address, City, State, PostalCode, StatusName
FROM Customers as c
JOIN Status as s on s.StatusID = c.StatusID
answer Jan 30, 2014 by Salil Agrawal
0 votes

A relation Schema denoted by R(A1, A2, ..., An) is made up of the relation name R and the list of attributes Ai that it contains. A relation is defined as a set of tuples. Let r be the relation which contains set tuples (t1, t2, t3, ..., tn). Each tuple is an ordered list of n-values t=(v1,v2, ..., vn).

answer Feb 1, 2014 by Vikas Upadhyay
...