0% found this document useful (0 votes)
5 views3 pages

Dbms Mid-2 Short Answers

The document provides a comprehensive overview of various SQL concepts, including the use of ORDER BY, differences between WHERE and HAVING clauses, and numeric functions. It also covers normalization, transaction management, and different types of locks in DBMS. Key topics include primary keys, subqueries, schema refinement, and transaction isolation levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Dbms Mid-2 Short Answers

The document provides a comprehensive overview of various SQL concepts, including the use of ORDER BY, differences between WHERE and HAVING clauses, and numeric functions. It also covers normalization, transaction management, and different types of locks in DBMS. Key topics include primary keys, subqueries, schema refinement, and transaction isolation levels.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

DBMS - SHORT ANSWERS

UNIT III

What is the use of ORDER BY Clause ?

The ORDER BY Clause is used to sort the records in either ascending or descending according to
one or more columns.
1
• By default ORDER BY sorts the data in ascending order.
Syntax: SELECT * FROM table_name ORDER BY column_name ASC|DESC
Example:SQL>select * from Teacher order by Name;

What is the difference between WHERE Clause and HAVING Clause ?

WHERE HAVING
2
WHERE clause in SELECT cannot be HAVING clause in SELECT can be
used a condition with aggregate functions condition with aggregate functions like
sum(), avg(),…
Explain any 4 numeric functions in SQL.

1. ABS ( m ) - It is used to get Absolute value of m


Example: SQL> select abs(-100) from dual; result: 100
2. MOD ( m, n ) - It is used to get Remainder of m divided by n
3
Example: SQL> select mod(10,2) from dual; result: 0
3. POWER ( m, n ) - It is used to get m power of n
Example: SQL> select power(4,3) from dual; result: 64
4. SQRT ( n ) - It is used to get square root of n
Example: SQL> select sqrt(9) from dual; result: 3
How do you define a primary key in SQL?

Add primary key to the column at the time of creation.


4 Example:
create table student
( rollno varchar2(10) primary key,
Name vachar2(10) );
Define subquery and give an example

A query in other query is called as Nested query. In other words we can say that a Sub
5 query is a query that is embedded in WHERE clause of another SQL query.
Example: SQL>select deptname from dept where deptno=(select deptno from emp
where eno=5);
Above displays the deptname where employ no 5 is working.
What is the difference between ANY and ALL in sub-queries

ANY means that the condition will be true if the operation is true for any of the values in
6
the range.
ALL means that the condition will be true only if the operation is true for all values in the
range.
Write the syntax for creating a view in SQL.

CREATE VIEW view_name AS SELECT column1, column2….. FROM table_name WHERE condition;
7
Example: SQL> create view TEACHERVIEW on TACHER where AGE >=50;
What is a self-join in SQL?
8
If any table join with the same table is called self join.
What are relational set operations in SQL?

UNION, UNION ALL, , INTERSECT, and EXCEPT are the set operations.
9 1. UNION - It returns rows from both tables except duplicates
2. UNION ALL- It returns rows from both tables including duplicates
3. INTERSECT- It returns common rows from both tables
EXCEPT (or MINUS) - It returns all rows from 1st table that are not in 2nd table
What is the difference between UNION and UNION ALL?

UNION UNION ALL


10
It returns rows from both tables except It returns rows from both tables including
duplicates duplicates

UNIT-IV
What is the purpose of schema refinement or normalization
1
Schema Refinement is also called as Normalization that is used to reduce the problems caused
by the data redundant in the tables by using decomposition technique.
What is the lossless join property in decomposition?
2
Decomposition is Lossless if R1 ⋈ R2 = R (join of R1 and R2 is same as to R).
Lossless Decomposition: If we decompose a relation R into relations R1 and R2, then this

Define dependency-preserving in decomposition


3
If you split table and the any one of the subtable have the dependencies of main table,
then it is dependency preservation
Define Surrogate key ?
4
A surrogate key is a unique identifier for a record in a database table that is not derived
from the application data.
What is the key requirement for a relation to be in 2NF?

5 A table is said to be in 2NF if both the following conditions hold:


1. Table is in 1NF (First normal form)
2. No partial dependency exist in the table
How does BCNF differ from 3NF?
6
 BCNF is stricter than 3NF
 For every functional dependency X->Y, X should be the super key of the table.
What is the main condition for a relation to satisfy Fourth Normal Form (4NF)?
7
 Table is in BCNF
 It must not contain more than one multivalued dependency.
Define Join Dependencies.
8
Join Dependency (JD) in Database Management Systems (DBMS) is a constraint that
ensures the original relation can be recreated by joining multiple sub-relations.
What is lossy decomposition ?

If we decompose a relation R into relations R1 and R2 and decomposition is lossy if R1 ⋈ R2 ⊃ R


9
If we get subset of R after joining R1 and R2 then it is lossy decomposition
What is Trivial Dependency ?
10
If the dependent attribute is a subset of determinant, then it is called trivial dependency. So, X -
> Y is a trivial functional dependency if Y is a subset of X.

UNIT-V
Define a Transaction?

1 The set of logically related operations that are done on the database is known as
transaction.
A transaction accesses the contents of a database by using read and write operations.
Example: Transfer Rs. 1000 from bank account A to account B is a transaction
What is concurrent execution in DBMS?
2
When the database is used simultaneously by different users for various operations that
is called concurrent execution.
List the different types of locks?

The DBMS mainly uses following types of locking techniques.


3
a. Binary Locking
b. Shared / Exclusive Locking
c. Two - Phase Locking (2PL)
What is the Transaction Isolation Level?

4 Transaction isolation levels in a database management system (DBMS) define the degree to
which the operations in one transaction are isolated from the operations of other concurrent
transactions.
What is the purpose of a transaction log in recovery?
5
A DBMS uses a transaction log to keep track of all transactions that update the database.
The information stored in this log is used by the DBMS for a recovery requirement.
How does the "Undo" operation work in transaction recovery?
6
The undo operation reverses the changes made by an uncommitted transaction,
restoring the database to its previous state.
List the classification of Failures in Transaction Management
7
1. Transaction failure 2. System crash 3. Disk failure
Explain TCL commands
Transaction Control Language Commands:
8 1. Commit
2. Rollback
3. Savepoint
What is the purpose of indexing?
9
It is used to search and retrieve the records fastly using indexing
List the advantages of Hash Based Indexing
10
Indexing is based on the Hast function.

You might also like