Dbms Mid-2 Short Answers
Dbms Mid-2 Short Answers
UNIT III
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;
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.
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?
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
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?
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.