Sunteți pe pagina 1din 3

Introduction to Oracle Database: Objective Type:

1) In a Employee Table, column E_Name contains the constraint VARCHAR (20) then How much Memory is allocated if we give the value to that column as emp1 ____________________ 2) In a Employee Table, column E_Name contains the constraint VARCHAR2 (20) then How much Memory is allocated if we give the value to that column as emp1 ____________________ 3) Constraints can be created during creating table and also during ____________________ 4) In a table if constraints are associated with more than one column then it is called ______________________ Constraints. 5) Write the Difference between Primary Key and UNIUQE Constraints ANS) _____________________________________________________________________________ __________________________________________________________________ 6) Foreign Keys in one table are ___________________ in other table. 7) Check Constraint can be used in Sub-quires a) If Yes , Give an Example______________________________________________________________________ b) If No, then Give Reason_______________________________________________________________________ 8) a) Deleting a record that contains a value referred to by a foreign key in another table would break ______________________. b) _________________ Concept is used for Deleting a record that contains a value referred to by a foreign key in another table. 9) Primary Key internally contains two constraints they are 1) _____________ and 2) _____________

10) Referential Integrity is created only in a) Parent Table b) Child Table c) Both a and b Ans _______________

Exercises:
Table-1 Details Table_Name: Jeweltable Column_Names: JewelId, JewelName, JewelWeight Table-2 Details Table_Name: Jewelcategory Column_Names: CategoryName, ItemPrice, ItemId

1) a) Create table Jeweltable with above mentioned details with the following constraints JewelId- should contain PrimaryKey as Constraint JewelName-- should contain varchar2 (8) as Constraint and NOTNULL Constraint JewelWeight-should contain number as constraint and also CHECK constraint which should not accept the value more than 100gms
b) Insert three records into the table with following values and according to above

constraints JewelId-101 JewelId-102 JewelId-103 2)


a) Insert into Jeweltable with following values and write the output

JewelName-SilverChain JewelName- GoldRing JewelName- SilverRing

JewelWeight-99 JewelWeight-25 JewelWeight-30

JewelId-1011

JewelName-DiamondRing JewelWeight-200 Write Output: _____________________


b) Insert into Jeweltable with following values and write the output

JewelId-1012 JewelName-null JewelWeight-100 Write Output: __________________ c) Change the following Column Constraints in Jeweltable 1) JewelName-- should contain varchar2 (8) as Constraint and NULL Constraint 2) JewelWeight-should contain number as constraint and also CHECK constraint which should not accept the value more than 100gms

3)
a) Create table Jewelcategory with above mentioned details with the following constraints

CategoryName - should contain varchar2 (8) as Constraint ItemPrice -- should contain number as Constraint and NOTNULL Constraint ItemId Use Foreign Key constraint for the column JewelId which is present in Jeweltable
b) Insert records into the table with following values and according to the table constraints

1) CategoryName: Chains

ItemPrice -4000

ItemId-101

Write Output: ____________________


2) CategoryName: Rings

ItemPrice -4500

ItemId-105

Write Output: ______________________

S-ar putea să vă placă și