Assignment-1: The Value For Cache Is Determined by Using The Formula
Assignment-1: The Value For Cache Is Determined by Using The Formula
2Q) Assume that a sequence S1 is created with the MAXVALUE m1, the
MINVALUE m2, INCREMENT BY i1, and with both CYCLE and CACHE
options. Then, what will be the maximum value that can be specified For
CACHE?
ANS:-
Sequence created.
----------------------------------0----------------------------------------
3Q)Assume that there are three tables T1, T2, and T3.each table is with
two columns TNAME and TID. T2 and T3 are referencing tables to T1 via
TID column with neither ON DELETE CASCADE nor ON DELETE SET NULL.
What are the scenarios in which the rows of T1 can be deleted and also
write the statements for creating the tables with the referential integrity
relationships between T1, T2 and T3?
ANS:-
TID TNAME
1 A
2 B
3 C
select * from t2;
Scenarios:-
T1=parent table T2=T3=child table;
On deleting the child rows in referencing table.
By dropping the constraint in the referenced table.
-------------------------------0--------------------------------
ANS:-
create sequence s1;
Sequence created.
NEXTVAL
NEXTVAL
2
NEXTVAL
NEXTVAL
NEXTVAL
NEXTVAL
NEXTVAL
NEXTVAL
NEXTVAL
10
NEXTVAL
Sequence altered.
NEXTVAL
11
----------------------------------------0-------------------------------------------
5Q) Give an example for a table having a composite primary key. Create
the table and provide the explanation for the scenario where this
requirement is needed?
ANS:-
Table created.
1 row created.
1 row created
1 row created.
1 row created.
1 siva 76
1 ravi 56
1 somu 89
3 somu 89
Scenarios:-
If two or more column together form primary key then it is called
composite primary key.
The combination of columns values should be unique.
We can define composite keys on referential integrity constraints.
Composite key can be defined alter levels only.
-----------------------------------0---------------------------------
QUESTION:1
coffice number,
cphone number,
Table created.
ioffice varchar2(10),
iphone number,
rank number,
Table created.
doffice varchar2(5),
dphone number,
Table created.
ccode number,
cleveldesc varchar2(10),
primary key(coname,ccode,clevel),
credits number,
cdesc varchar2(50),
Table created.
mname varchar2(10),
lname varchar2(10),
saddr varchar2(20),
sph number,
mcode number,
dob date,
grade varchar2(4),
Table created.
secno varchar2(3),
year number,
sem number,
bldg varchar2(4),
croom varchar2(6),
cdays varchar2(25),
ctimings varchar2(25),
Table created.
desc college;
COFFICE NUMBER
CPHONE NUMBER
DENAME VARCHAR2(10)
1 row created.
1 row created.
desc inst;
ID NUMBER
INAME VARCHAR2(10)
IOFFICE VARCHAR2(10)
IPHONE NUMBER
RANK NUMBER
CNAME VARCHAR2(5)
1 row created.
desc dept;
DCODE NUMBER
DOFFICE VARCHAR2(5)
DPHONE NUMBER
HOD VARCHAR2(10)
CSTART DATE
ID NUMBER
insert into dept values('ECE',4,'EC-1',7776565451,'VENKATRAO','15-
JUN-2003',1);
1 row created.
1 row created.
1 row created.
CLEVELDESC VARCHAR2(10)
CREDITS NUMBER
CDESC VARCHAR2(50)
DNAME VARCHAR2(5)
1 row created.
1 row created.
insert into course values('NETWORK',786,3,'JUNIOR',120,'NETWORKS
REPESENTATION','EEE');
1 row created.
1 row created.
1 row created.
1 row created.
6 rows selected.
desc student;
FNAME VARCHAR2(10)
MNAME VARCHAR2(10)
LNAME VARCHAR2(10)
SID NUMBER
SADDR VARCHAR2(20)
SPH NUMBER
MCODE NUMBER
DOB DATE
GRADE VARCHAR2(4)
DNAME VARCHAR2(5)
1 row created.
1 row created.
select * from student;
FNAME MNAME LNAME SID SADDR SPH MCODE DOB GRAD DNAME
BUS STAND
BUS STAND
desc section;
SECID VARCHAR2(5)
SECNO VARCHAR2(3)
YEAR NUMBER
SEM NUMBER
BLDG VARCHAR2(4)
CROOM VARCHAR2(6)
CDAYS VARCHAR2(25)
CTIMINGS VARCHAR2(25)
SID NUMBER
1 row created.
1 row created.
------------------------------------------------0------------------------------------------