Chapter – 7. DATA BASE CONCEPTS

2002

5.a. Differentiate between data definition language and data manipulation language.

Ans. The SQL DDL(Data Definition Language) provides commands for defining relation schemas, deleting relations, creating indexes and modifying relation schemas. The SQL DML (Data Manipulation Language) includes a query language to insert, delete and modify tuples in the database. DML is used to put values and manipulate them in tables and other database objects and DDL is used to create tables and other database objects.

2001

5.c. Explain Cartesian product of two relations.

Ans: The Cartesian product is a binary operation and is denoted by a cross(x). The Cartesian product of two relations A and B is written as AXB. The Cartesian product yields a new relation which has a degree (number of attributes) equal to the sum of the degrees of the two relations operated upon. The number of typles (cardinality) of the new relation is the product of the number of tuples of the two relations operated upon. The Cartesian product of two relations yields a relation with all possible combinations of the tuples of the two relations operated upon. All tuples of first relation are concatenated with all the tuples of second realtion to form the tuples of the new relation.
Eg: There are two relations as follows:
Relation 1: Student
StudentNumber StudentName Hosteler
1 Ravi Y
2 Robert N
3 Raheem Y

Relation 2: Instructor
InstructorName Subject
K.Suman Computer Science
P.Pavan Electronics

The Cartesian product of these two relations,
Student X Instructor, will yield a relation that have a degree of 5(3+2:sum of degrees of Student and Instructor) and a cardinality 6 (3 X 2: Product of cardinalities of two relations).

The resulting relation is as follows:

Student Number Student Name Hosteler Instructor Subject Name
1 Ravi Y K.Suman Computer Science
1 Ravi Y P.Pavan Electronics
2 Robert N K.Suman Computer Science
2 Robert N P.Pavan Electronics
3 Raheem Y K.Suman Computer Science
3 Raheem Y P.Pavan Electronics

The resulting relation contains all possible combinations of tuples of the two relations.

1998

5.a. What is a relation? What is the difference between a tuple and an attribute?

Ans. In relational data model, the data is organized into table (rows and columns). These tables are called relations. A row in a table represents a relationship among a set of values.
Rows of the relations are called as tuples and columns of the relations are called as attributes.