0% found this document useful (0 votes)
34 views27 pages

SUMMER 2021 Paper Solution - DBMS

For pyq and notes

Uploaded by

kathanp4855
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views27 pages

SUMMER 2021 Paper Solution - DBMS

For pyq and notes

Uploaded by

kathanp4855
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

DBMS SUMMER 2021 SOLUTION

Q1 (A) What is Data Definition Language? List DDL statements & explain
anyone with example (3M)
ANS
Data Definition Language
 Data Definition Language(DDL) is a specialised language used to
specify or database schema by set of definitions
 It is a language which is used for creating and modifying the
structures of tables, views, index and so on
 DDL is also used to specify additional properties of data
 Some of the common commands used in DDL are : CREATE, ALTER &
DROP

z
 CREATE
aa
 CREATE TABLE statement is used to create a new table in
database
Aw
 Syntax :
CREATE TABLE table_name{
column1 datatype,
ut

column2 datatype,
};
gr

 Example :
Ja

CREATE TABLE persons{


personID int,
LastName varchar(255);
FirstName varchar(255);
Address varchar(255);
};

Click :Youtube Channel | Free Material | Download App


Q1 (B) List & explain ACID property of transaction

ANS
ACID property of transaction
1) Atomicity
2) Consistency
3) Isolation
4) Duration

1. Atomicity
 These properties states that each transactions must be
considered as a single unit and must be completed fully or not
completed at all
 No transaction in the database is left half completed

z
 Database should be in a state either before the transaction
aa
execution or after the transaction execution. It should not be in
state executing
Aw

2. Consistency
 The database must remain in consistent state after performing
ut

any transaction
gr

3. Isolation
Ja

 In a database system and more than one transaction are being


executed simultaneously and in parallel, the property of
isolation states that all the transactions will be carried out an
executed as it is only transaction in the system
 No transaction will affect existence of any other transaction

4. Duration
 The database should be strong enough to handle any system
failure
 If there is any set of insert/update, then it should be able to
handle & commit to database
 If there is any failure, database should be able to recover M to
consistent state

Click :Youtube Channel | Free Material | Download App


Q1 (C) Consider relation R = {A, B, C, D, E, I} and set of functional
dependencies
F = {{A,B} → C , A → {D, E} , B → F, F → {G,H}, D → {I, J}
What is key R? Decompose R into 2NF, then 3NF relations (7M)

ANS

For finding (AB)+ = {A, B, C, D, E, F, G,H}


So, AB is superkey
AB is also a candidate key
But here, AB is only candidate key
C.K = AB

In given relation, partial dependency present in relation [For 2NF]


A → DE

z
B→F aa
(A)+ = {A, D, E, I, J}
(B)+ = {E, F, G, H}
Aw

R1 = {A, D, E, I}
R2 = {B, F, G, J}
ut

R3 = {A, B, C}
gr

Decompose into 2NF


Ja

R1 = {A, D, E, I, J}
R2 = {B, F, G, J}
R3 = {A, B, C}

Decompose into 3NF


R1 {A, D, E, I, J}
(A)+ = {A,D, E, I,J}
A is sk & ck
A → DEIJ

(D)+ = {D, I, J}
D → IJ
T.D is present
(D)+ = {D, I, J}

Click :Youtube Channel | Free Material | Download App


R1A = (D, I, J)
R1B = (A, E,D)

R2 (B, F, G, H)
(B)+ = {B, F, G, H}
B → FGH
(F)+ = {F, G, H}
F → GH TD is present
Here B is ck & sk

R2A = (F, G, H)
R2B = (B, F)
R3 = (A, B, C)
AB → C
AB is SK

z
So R3 in 3NF aa
3NF : -
Aw

R1A = (D, I, J)
R1B = (A, E, D)
R2A = (F, G, H)
ut

R2B = (B, F)
gr

R3 = (A, B, C)
Ja

Q2 (A) Difference shared lock & exclusive locked based protocol (3M)

ANS

Shared Lock Exclusive Lock


Lock is read only operations Lock mode is read as well as
write operations
S lock is requested using Lock – S X lock is requested using Lock –
instructions X instructions
Shared Lock can be placed on objects Exclusive Lock can only placed
that do not have an exclusive lock m objects that do not have any
already placed on them other kind of lock
Any number of transaction can hold Exclusive Lock can be done by
shared lock on an item only one transaction

Click :Youtube Channel | Free Material | Download App


Q2 (B) Describe cartesian product operation in relational algebra (4M)

ANS

 Cartesian product in DBMS is an operation used to manage columns


from two relations
 Generally, a Cartesian product is never or more fil operation when it
performs alone
 However, it becomes meaningful when it is follows by other
operations. It is called cross product
 Example
σcolumns = σi . (A × B)
Output : The above example all rows from relation A & B whose
column 2 has value
Column 1 Column 2

z
1
1
1
1
aa
Aw

Q2 (C) Draw an ER diagram for student management system (7M)


ut

ANS
gr
Ja

Click :Youtube Channel | Free Material | Download App


OR
Q2(C) Consider relational database given below. Give an expression in
relation algebra to express each queries : (7M)
Employee(person_name, street, city)
Works(person_name, company_name, salary)
Company(person_name, city)
Manager(person_name, manager_name)
a) Find name of all employees
b) Find city of employee whose name is ‘jashu’
c) Find name and city of all employee who are having salary > 50000
d) Find total salary of employees who are working for company HCL

ANS

a) Find name of all employees

z
Πperson_name (Employee) aa
b) Find city of employee whose name is ‘jashu’
Aw

Πcity(σperson_name=’Jashu’ (Employee)

c) Find name and city of all employee who are having salary > 50000
ut

Πperson_name, city(σsalary>50000 (Employee ⋈ Works)


gr

d) Find total salary of employees who are working for company HCL
Ja

Salary Gsum(salary) (σcompany_name = ‘HCL’ (Works))

Q3(A) Describe various state of transaction (3M)

ANS

Click :Youtube Channel | Free Material | Download App


Active State
 The active state is the first state of every transaction
 In this state, the transaction being executed
 For example : insertion and deletion are updating a record is done
here. But all the records are still not saved to the database

Partially Committed
 In the partially committed state, a transaction executes its final
operation, But the data is still not saved in database
 In total mark calculation example, a final display if total masks step is
executed in this state

Committed
 A transaction is said to be committed state if it executes all its

z
operations successfully
 In this state, all effects are now permanently saved on database
aa
system
Aw

Failed State
 If any of checks made by database recovery system fails, then
ut

transaction is said to be in failed state


 In example of total mark calculation, if database is not able to fire a
gr

query to fetch marks, then transaction will fail to execute


Ja

Aborted
 If any of checks fail and transaction has reached a failed state then
database recovery system will make sure that database is in its
previous transaction to bring database into consistent state

Q3(B) List & explain mapping cardinalities of E – R diagram with example

ANS

 It is expressed as the number of entities to which another entity can


be associated via relation set
 For binary relationship set there are entity set and B then mapping
cardinality can be one following

Click :Youtube Channel | Free Material | Download App


 One to One
 One to Many
 Many to One
 Many to Many

 One to One Relationship


 One entity of A is associated with one entity of B

 Example : Given below is an example of one to one relation in

z
mapping cardinality. Here one department has one head of
department (HOD) aa
Aw
ut

 One to Many Relationship


gr

 An entity set A is associated with any number of entities in B


with possibility of zero & entity B is associated with atmost one
Ja

entity in A

 Example : Given below is an example of one to many


relationship in mapping cardinality. Here one department has
many facilities

Click :Youtube Channel | Free Material | Download App


 Many to One Relationship
 An entity set A is associated with at most one entity in B and an
entity set in B can be associated with any number of entities

 Example : Given below is an example of many to one


relationship in mapping cardinality. Here, many faculties work in
one department

z
 Many to Many Relationship aa
 Many entities of A are associated with many entities of B
Aw
 An entity in A is associated with many entities of B and an entity
in B is associated with many entities of A
 Many to Many = Many to One + One to Many
ut
gr
Ja

 Example : Given below is an example of many to one


relationship in mapping cardinality there are employee work on
many projects

Click :Youtube Channel | Free Material | Download App


Q3(C) What is use of two – phase locking protocol in concurrency
control? Describe two – phase locking protocol in detail (7M)

ANS
Two – phase locking protocol
 Two - phase locking protocol divides the execution phase of the
transaction into 3 parts
1) In the first part, when the execution of transaction starts, it
seeks permission for the lock it requires
2) In the second part, transaction acquires all the locks
3) The third phase is started as soon as transaction releases its first
lock. In third phase, transaction cannot demand any new locks,
it only releases acquired lock

z
aa
Aw
ut

 There are two phases of 2PL :


1) Growing Phase : In the growing phase, a new lock on data item,
gr

may be acquired by transaction, but none can be released


Ja

2) Shrinking Phase : In the shrinking phase, existing lock held by


transaction may be released but no new locks can be acquired

 In below example, if lock conversion is allocated then following


phases can happen :
1) Upgrading of lock from S(a) to X(a) is allowed in growing phase
2) Downgrading of lock from X(a) to S(a) must be done in shrinking
phase
 Example
T1 T2
0 LOCK S(A)
1 LOCK S(A)
2 LOCK X(B)
3

Click :Youtube Channel | Free Material | Download App


4 UNLOCK(A)
5 LOCK X(C)
6 UNLOCK(B)
7 UNLOCK(A)
8 UNLOCK (B)
9

 Following way shows how unlocking and locking work with 2 – PL


 Transaction T1
 Growing Phase : from step 1 – 3
 Shrinking Phase : from step 5 – 7
 Lock Point : at 3
 Transaction T2
 Growing Phase : from step 2 – 6
 Shrinking Phase : from step 6 – 9

z
 Lock Point : at 6 aa
Aw
OR
Q3(A) What is dirty write in transaction? Explain with example (3M)

ANS
ut
gr

Dirty Write
 Dirty read problem occurs when one transaction updates on item of
Ja

the database and somehow transaction fails and before data gets
rollback updated database item is accessed by another transaction.
There comes the Read – write conflict between both transaction
 For example :
Consider two transaction TX & TY in below diagram performing
read/write operation on account A where available balance in
account A is $300
Time T1 T2
t1 READ(A) -
t2 A = A+ 50 -
t3 WRITE(A) -
t4 - READ(A)
t5 SERVER DOWN/
ROLLBACK

Click :Youtube Channel | Free Material | Download App


 At time t1, transaction Tx reads value of account A1 i.e $300
 At time t2, transaction Tx adds $50 to account A that becomes $350
 At time t3, transaction Tx writes updated values in account A i.e $350
 Then at time t1, transaction Ty reads account A that will be read as
$350
 Then at time t5, transaction Tx rollback due to server problem and
value changes back to $300
 But value for account A remain $350 for transaction Ty as committed
which is dirty read and therefore known as dirty read problem

OR
Q3(B) What are importance of Primary Key & Unique Key in database?
Explain with example (4M)

z
ANS aa
Aw
Primary Key
 The primary key is unique or non – null key that uniquely identifies
every record in the table or relation
ut

 The primary key column cannot store duplicate value that means
primary key column values are always unique. It is also called a
gr

minimal super key


 Therefore we cannot specify more than one primary key in any
Ja

relationship
 A primary key column of one table can be referred by a foreign key
column of another table
 Example :
We have table named students with attributes such as stud_id,
roll_no, Name, Mobile or Email

 Features
 The primary key column cannot contain duplicate values
 The primary key implements the entity of the table
 A table cannot have more than one primary column

Click :Youtube Channel | Free Material | Download App


 We can make the primary key from one or more table fields
 The primary key column should not have NOT NULL
constraints

Unique Key
 Unique Key is single column or combination of column in a table to
uniquely identifies database record
 A unique key prevents from storing duplicate values in a column
 A table can contain multiple unique key column unlike a primary key
column
 This key is similar to primary key, expect that one NULL value can be
stored in the unique column. The unique is also called unique
constraint and can be referred by another table’s foreign key
 Example
Let’s consider same table named students with attributes such as

z
stud_ID, Roll_No, Name, Mobile & Email aa
Aw

 Features of Unique Key


ut

 We can construct the unique key from one or more table fields
gr

 A table can define multiple unique key columns


 By default a unique key is in non – clustered unique indexes
Ja

 The unique constraint column can store NULL value but only
one NULL is allowed null per column
 The foreign key can reference unique constraint in preserving
uniqueness of table

OR
Q3(C) What is deadlock in transaction? How to detect deadlock in
system? Explain with example (7M)

ANS

Deadlock
 A deadlock is a condition where two or more transactions are waiting
indefinitely for one another to give up locks

Click :Youtube Channel | Free Material | Download App


 Deadlock is said to be one of the most feared complications in DBMS
as no task ever gets finished and is in waiting state forever
 Example :
 In the student table, transaction T1 holds on some rows &
needs to update some row to grade table simultaneously,
transaction T2 holds locks on some rows in grade table & needs
to updated rows in student table held by transaction
 Now main problem arises. Now transaction is waiting for T2 to
release its lock & similarly T2 is waiting for T1 to release its lock.
All activities come to hold state & remain at stand. It will remain
in standstill until the DBMS and deadlock & aborts one of
transaction

z
aa
Aw

 Deadlock Detection
 In a database, when a transaction wait to obtain a lock, then
ut

DBMS should detect where transaction is involved in a deadlock


gr

or not. Lock manager maintains the wait for graph to detect the
deadlock cycle in the details
Ja

 Wait for Graph


 This is the suitable method for deadlock detection
 In this method, a graph is created based on the transaction and
their lock. If the created graph has cycle or closed loop then
there is a deadlock
 The wait for graph is maintained by system. For every
transaction which is waiting for some data held by others the
system keeps checking the graph if there is any cycle in graph

Click :Youtube Channel | Free Material | Download App


Q4(A) Difference between Closed Hashing & Open Hashing (3M)
ANS

Closed Hashing Open Hashing


In a closed hashing method, a new In open hashing, next available
data bucket is allocated with same data block is used to enter new
address record
This method is also known as This method is also called Linear
overflow chaining Probing
Deletion is difficult Deletion is easier

Q4(B) What is role of an index in DBMS? Explain dense index with example
(4M)

z
ANS aa
Aw
Indexing
 Indexing is used to optimise the performance of database by
minimising the number of disk access required when a query is
ut

processed
 The index is a type of data structure. It is used to locate an access the
gr

data in database table quickly


Ja

Dense Index
 The dense index contains an index record for every search key value
in data file. It makes search faster
 In this, number of records in the index table is same as the number of
records in the main table
 It needs more space to store index record itself. The index record
have the search key and point to the actual record on the table

Click :Youtube Channel | Free Material | Download App


Q4(C) What is schedule in transaction? How to identify that given
schedule is conflict serializable? Explain with example (7M)

ANS
Schedule
 A series of operation from one transaction to another transaction is
known as Schedule. It is used to preserve the order of the operation
in each of the individual transaction

Conflict Serializable
 The two operations become conflicting if conditions satisfy
1) Both belongs to separate transactions
2) They have the same data item
3) They contain at least one write operations

z
 Example aa
Swapping is possible only if S1 and S2 are logically equal
Aw
1) T1 : Read(A) T2 : Read (A)
ut
gr

Here, S1 = S2 that means it is non conflict


Ja

2) T1 : Read(A) T2 : Write(A)

Here,S1 ≠ S2 that means it is conflict

3) T1 : Write(A) T2 : Read(A)

Here,S1 ≠ S2 that means it is conflict

Click :Youtube Channel | Free Material | Download App


4) T1 : Write(A) T2 : Write(A)

Here,S1 ≠ S2 that means it is conflict

 In the conflict equivalent one can be transformed to another by


swapping non conflicting operations. In given example, so it is conflict
equivalent S1 (S1 can be executed to S2) by swapping non –
conflicting operations
 Example

z
aa
Aw
ut
gr

OR
Ja

Q4(A) What is log based recovery? Listen explain various field used in log
records in for log based recovery? (3M)

ANS

Log based recovery


 Log is a sequence of records. Log of each transaction is maintained in
some stable storage. So that if any failure occurs, then it can be
recovered from here
 If any operation is performed on the database then it will be
recorded in log
Fields used in log records
 An update log record represented as : <Ti × ji> has three fields
1) Transaction Identifier : Unique identifier of the transaction that
performed the write operation

Click :Youtube Channel | Free Material | Download App


2) Data Item : Unique identifier of data item written
3) Old Value : Value of data item prior to write
4) New Value : Value of data item after write operations
 Other types of log records
1) <Ti start> : It contains information about when transaction Ti
start
2) <Ti commit> : It contains information about when transaction Ti
commit
3) <Ti abort> : It contains information about when transaction Ti
aborts
OR
Q4(B) Discuss view serializability in transaction (4M)

ANS

z
View Serializability aa
 A schedule will view serializable if it is view equivalent to serial
schedule
Aw

 If a schedule is conflict serializable then it will be view serializable


 The view serializable which does not conflict serializable contains
ut

blind writes
gr

View Equivalence
 Two schedules S1 & S2 are said to be view equivalent if they satisfy
Ja

following conditions
1) Initial Read
 An initial read of both schedule must be the same
 Suppose two schedule S1 & S2. In schedule S1 if a transaction
T1 is reading data, item A in S2 transaction T1 should also read
A

 Above two schedule are view equivalent because initial read


operation in S1 is done by T1 and in it is done by T1

Click :Youtube Channel | Free Material | Download App


2) Update Read
 In schedule S1, if Ti is reading A which is updated by Tj then in S2
also, Ti should read A which is updated by Tj

 Above two schedules are not view equal because in S1, T3 is


reading A updated by T2 and in S2, T3 is reading A updated by
T1

3) Final Write
 A final write must be same between both schedules. In
schedule S1 if transaction T1 updates A at last then in S2, final

z
writes operations should also be done by T1
aa
Aw

 Above two schedules is view equal because final write


ut

operations in S1 is done by T3 & in so final write operation is


gr

done by T3
Ja

OR
Q4(C) Explain various steps involved in query processing with example (7M)

ANS

Steps involved in query processing


1) Parsing & Translation
2) Optimization
3) Evaluation

1. Parsing & Translation


 A query processing includes certain activities for data retrieval

Click :Youtube Channel | Free Material | Download App


 Initially the given user queries gets translated in high level database
languages such as SQL
 It gets translated into expression that can be further used at
physical level of the file system
 After this the actual evaluation of queries and a variety of query
optimising transformation takes place
 Thus before processing query a computer system needs to
translate the query into human readable and understandable
language
 SQL is best suitable choice for humans but it is not perfectly
suitable for the internal representation of the query of the system
 Relational algebra is well suited for through internal representation
of the query
 When a user executes any query for generation the internal form of

z
the query, the parser in the system checks the syntax of the query,
aa
verifies the name of the relation in the database, tuple & finally
required attribute value
Aw

2. Optimization
 SQL is very high level languages
ut

 The user specified what to search for now. How is search


actually done
gr

 The algorithms are chosen automatically by DBMS


 For a given SQL query there may be many possible execution plan
Ja

 Amongst all equivalent plans choose one with lowest cost


 Cost is estimated using statistical information from the database
catalogue

3. Evaluation
 For this with addition the relational algebra translation, it is
required to annotate translated relational algebra expression with
instruction used for specify and evaluation each operation. Thus
after translating the user the system executes a query evaluation
plan
 A query evaluation plan is responsible for output of the given query

Click :Youtube Channel | Free Material | Download App


Q5(A) Explain SQL Injection in brief (3M)

z
ANS
SQL Injection
aa
 SQL injection is the code penetration technique that might cause loss
Aw

throughout database
 It is one of the most prettiest web hacking techniques to place
ut

malicious code in SQL statements via webpage input


 SQL injection can be used to manipulate the applications web server
gr

by malicious user
 A successful attack may result in the unauthorised viewing of users
Ja

list, the deletion of entire table gaining administrative rights to a


database all of which are highly detrimental to a business

Click :Youtube Channel | Free Material | Download App


Q5(B) What is use of cursor in PL/SQL? Explain with example (4M)

ANS

Cursor
 When an SQL statement is processed, oracle creates a memory area
known as context area
 A cursor is a point to this context area. It contains all information
needed for processing the statement
 In PL/SQL the contact area is controlled by the cursor. A cursor
contains information on a select statement and rows of data accessed
by it
 A cursor is used to referred to program fetch & process row returned
by SQL statement, one at time. There are two types of cursor
1) Implicit Cursor

z
2) Explicit Cursor
Implicit Cursor
aa
 The implicit cursor automatically generated by Oracle while an SQL
Aw

statement is executed if you don’t use an explicit cursor for the


statement
 These are created by default to process the statement when DML
ut

statement like INSERT, UPDATE, DELETE etc are executed


gr

 Oracle provides some attributes known as implicit cursors attributes


Ja

to check the status of DML operations. Some of them are %FOUND,


%ROWCOUNTER and ISOPEN
Explicit Cursor
 The explicit cursors are defined by programmer to gain more control
over the context area
 This cursors should be defined in the declaration section of PL/SQL
block. It is created on a select statement which returns more than
one row

 Example :
CURSOR cursor_name IS select_statement;
OPEN cursor_name
FETCH cursor_name INTO variable_list
CLOSE cursor_name

Click :Youtube Channel | Free Material | Download App


Q5(C) Consider the following relations and write SQL queries for given
statements. Assume suitable constraints.
job(job-id, job-title, minimum-salary, maximum-salary) employee(emp-
no, emp-name, emp-salary,dept-no)
deposit(acc-no, cust-name, branch-name, amount, account-date)
borrow(loan-no, cust-name, branch-name, amount) department (dept-
no, dept-name)
a) Give name of employees whose employee number is '001'
b) Give name of depositors whose branch name starts from ‘S’.
c) Give employee name(s) whose salary is between Rs. 20000 to
30000 and department name is Finance
d) Update the salary of employee by 10% of their salary who is
working in the Finance department (7M)

ANS

z
a) Give name of employees whose employee number is '001'
aa
SELECT emp-name
FROM employee
Aw

WHERE emp-no = '001';

b) Give name of depositors whose branch name starts from ‘S’.


ut

SELECT cust-name
gr

FROM deposit
WHERE branch-name LIKE 'S%';
Ja

c) Give employee name(s) whose salary is between Rs. 20000 to 30000


and department name is Finance
SELECT e.emp-name
FROM employee e
JOIN department d ON e.dept-no = d.dept-no
WHERE e.emp-salary BETWEEN 20000 AND 30000
AND d.dept-name = 'Finance';

d) Update the salary of employee by 10% of their salary who is


working in the Finance department
UPDATE employee
SET emp-salary = emp-salary * 1.10
WHERE dept-no IN (SELECT dept-no FROM department WHERE
dept-name = 'Finance');

Click :Youtube Channel | Free Material | Download App


OR Q5(A) Describe two rules of mandatory access control (3M)
ANS

Mandatory Access Control


 Mandatory access control technique for multi level uses 4
components
1) Subject : Users, Accounts, Programs etc
2) Object : Relation, Tuples, Attribute etc
3) Clearance Level : Top Secret (TS), Secret (S), Confidential (C) ,
Unclassified (U). Each subject is classified into one of these four
classes
4) Security Level : Such as Top Secret (TS), Secret(S),
Confidential(C) & Unclassified(U). Each object is classified into
one of these four classes

z
In above system TS > S > C > U, where TS > S means class TS
aa
object is more sensitive than class S object.
A user can access data by following two rules :
Aw

a) Security Property :
 Security Property states that subject at given security
level may not read an object at higher security level
ut

b) Star Security Property


gr

 Star (*) property states that subject at given security


level may not write an object at higher security level
Ja

OR Q5(B) Describe Grant & Revoke commands with example (4M)

ANS

Grant
 SQL grant is a command used to provide access or privileges on
database object to users
 Syntax :
GRANT privilege_name
ON object_name
TO{user_name|public|rolename}
{with grant option}

Click :Youtube Channel | Free Material | Download App


 privilege _name : Access right on privilege granted to user. Some of
access rights are ALL, EXECUTE and SELECT
object_name : Name of database object like TABLE, VIEW, STORED
PROC
user_name : Name of user to whom on access right is being granted
PUBLIC : To grant access rights to all users
ROLES : Set of privileges grouped together
WITH GRANT OPTION : Allows user to grant access rights to other
users

Revoke
 REVOKE command removes user access rights or privileges to
database objects
 Syntax :
REVOKE privilege_name

z
ON object_name
FROM {user_name|public|role_name}
aa
Aw

OR Q5(C) Write PL/SQL program that fetches records as students having CPI
> 4 in ELIGIBLE table & students having CPI < = 4 in NOT_ELIGIBLE table from
ut

student_master table (7M)


gr

ANS
Ja

Declare
create table eligible{
studID int;
stud_name varchar(255);
sem varchar(10);
CPI int;
}
create table not_eligible{
studID int;
stud_name varchar(255);
sem varchar(10);
CPI int;
}
CPI integers

Click :Youtube Channel | Free Material | Download App


begin
CPI : = CPI;
if(CPI > 4) then
Insert into eligible values(‘1’,’XYZ’, ‘3’,’CPI’)
else
Insert into not_eligible values(‘2’,’ABC’,’3’,’CPI’)
END

z
aa
Aw
ut
gr
Ja

Click :Youtube Channel | Free Material | Download App

You might also like