DBMS is a collection of programs that allows users to create and maintain a database. It provides an interface for performing operations like creating, inserting, updating, and deleting data from the database. The collection of database and DBMS software together is known as a database system. Some key advantages of DBMS include redundancy control, restricting unauthorized access, enforcing data integrity, and making data easily accessible.
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 ratings0% found this document useful (0 votes)
37 views17 pages
DBMS Viva Questions - Coders Lodge
DBMS is a collection of programs that allows users to create and maintain a database. It provides an interface for performing operations like creating, inserting, updating, and deleting data from the database. The collection of database and DBMS software together is known as a database system. Some key advantages of DBMS include redundancy control, restricting unauthorized access, enforcing data integrity, and making data easily accessible.
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/ 17
1. What is DBMS?
DBMS is a collection of programs that facilitates users to create and
maintain a database. In other words, DBMS provides us an interface or tool for performing different operations such as the creation of a database, inserting data into it, deleting data from it, updating the data, etc. 2. What is a database system? The collection of database and DBMS software together is known as a database system. Through the database system, we can perform many activities such as- The data can be stored in the database with ease, and there are no issues of data redundancy and data inconsistency. 3. What are the advantages of DBMS? • Redundancy control • Restriction for unauthorized access • Provides multiple user interfaces • Provides backup and recovery • Enforces integrity constraints • Ensure data consistency • Easy accessibility • Easy data extraction and data processing due to the use of queries 4. What is RDBMS? RDBMS stands for Relational Database Management Systems. It is used to maintain the data records and indices in tables. RDBMS is the form of DBMS which uses the structure to identify and access data concerning the other piece of data in the database. 5. How many types of database languages are? There are four types of database languages: • Data Definition Language (DDL) e.g., CREATE, ALTER, DROP, TRUNCATE, RENAME, etc. All these commands are used for updating the data that’s why they are known as Data Definition Language. • Data Manipulation Language (DML) e.g., SELECT, UPDATE, INSERT, DELETE, etc. These commands are used for the manipulation of already updated data that's why they are the part of Data Manipulation Language. • DATA Control Language (DCL) e.g., GRANT and REVOKE. These commands are used for giving and removing the user access on the database. So, they are the part of Data Control Language. • Transaction Control Language (TCL) e.g., COMMIT, ROLLBACK, and SAVEPOINT. These are the commands used for managing transactions in the database. TCL is used for managing the changes made by DML. 6. Why is the use of DBMS recommended? Explain by listing some of its major advantages? Some of the major advantages of DBMS are as follows: • Controlled Redundancy: DBMS supports a mechanism to control the redundancy of data inside the database by integrating all the data into a single database and as data is stored in only one place, the duplicity of data does not happen. • Data Sharing: Sharing of data among multiple users simultaneously can also be done in DBMS as the same database will be shared among all the users and by different application programs. • Backup and Recovery Facility: DBMS minimizes the pain of creating the backup of data again and again by providing a feature of ‘backup and recovery’ which automatically creates the data backup and restores the data whenever required. • Enforcement of Integrity Constraints: Integrity Constraints are very important to be enforced on the data so that the refined data after putting some constraints are stored in the database and this is followed by DBMS. • Independence of Data: It simply means that you can change the structure of the data without affecting the structure of any of the application programs. 7. What do you understand by Data Model? The Data model is specified as a collection of conceptual tools for describing data, data relationships, data semantics and constraints. These models are used to describe the relationship between the entities and their attributes. There is the number of data models: • Hierarchical data model • network model • relational model • Entity-Relationship model and so on. 8. Define a Relation Schema and a Relation. A Relation Schema is specified as a set of attributes. It is also known as table schema. It defines what the name of the table is. Relation schema is known as the blueprint with the help of which we can explain that how the data is organized into tables. This blueprint contains no data. A relation is specified as a set of tuples. A relation is the set of related attributes with identifying key attributes. 9. What is a degree of Relation? The degree of relation is a number of attributes of its relation schema. A degree of relation is also known as Cardinality it is defined as the number of occurrences of one entity which is connected to the number of occurrences of other entity. There are three degree of relation they are one-to-one (1:1), one-to- many(1:M), many-to-one(M:M). 10. What is the Relationship? The Relationship is defined as an association among two or more entities. There are three type of relationships in DBMS- • One-To-One: Here one record of any object can be related to one record of another object. • One-To-Many (many-to-one): Here one record of any object can be related to many records of other object and vice versa. • Many-to-many: Here more than one records of an object can be related to n number of records of another object. 11. What is the difference between having and where clause?
HAVING is used to specify a condition for a group or an
aggregate function used in a select statement. The WHERE clause selects before grouping. The HAVING clause selects rows after grouping. Unlike the HAVING clause, the WHERE clause cannot contain aggregate functions. 12. What are the disadvantages of file processing systems? • Inconsistent • Not secure • Data redundancy • Difficult in accessing data • Data isolation • Data integrity • Concurrent access is not possible • Limited data sharing • Atomicity problem 13. What is data abstraction in DBMS? Data abstraction in DBMS is a process of hiding irrelevant details from users. Because database systems are made of complex data structures so, it makes accessible the user interaction with the database. 14. Define Aggregate functions. Functions which operate against a collection of values and returning single value is called aggregate functions. 15. What are the three levels of data abstraction? Following are three levels of data abstraction: • Physical level: It is the lowest level of abstraction. It describes how data are stored. • Logical level: It is the next higher level of abstraction. It describes what data are stored in the database and what the relationship among those data is. • View level: It is the highest level of data abstraction. It describes only part of the entire database.
16. What is Relational Algebra?
Relational Algebra is a Procedural Query Language which contains a set of operations that take one or two relations as input and produce a new relationship. There are few fundamental operations of relational algebra: • select • project • set difference • union • rename, etc. 17. What is Relational Calculus? Relational Calculus is a Non-procedural Query Language which uses mathematical predicate calculus instead of algebra. Relational calculus doesn't work on mathematics fundamentals such as algebra, differential, integration, etc. That's why it is also known as predicate calculus. There are two types of relational calculus: • Tuple relational calculus • Domain relational calculus 18. What are super, primary, candidate, and foreign keys?
A super key is a set of attributes of a relation schema upon
which all attributes of the schema are functionally dependent. No two rows can have the same value of super key attributes.
A Candidate key is a minimal super key, i.e., no proper subset
of Candidate key attributes can be a super key.
A Primary Key is one of the candidate keys. One of the
candidate keys is selected as most important and becomes the primary key. There cannot be more than one primary key in a table.
A Foreign key is a field (or collection of fields) in one table that
uniquely identifies a row of another table. 19. What is normalization? Normalization is a process of analysing the given relation schemas according to their functional dependencies. It is used to minimize redundancy and also used to minimize insertion, deletion and update distractions. Normalization is considered as an essential process as it is used to avoid data redundancy, insertion anomaly, updation anomaly, deletion anomaly. There most commonly used normal forms are: o First Normal Form(1NF) o Second Normal Form(2NF)
o Third Normal Form(3NF)
o Boyce & Codd Normal Form (BCNF)
20. Define Join and enlist its types.
Joins help in explaining the relation between different tables. They also enable you to select data with relation to data in another table. The various types are: o INNER JOINs: Blank rows are left in the middle while more than equal to two tables are joined. o OUTER JOINs: Divided into Left Outer Join and Right Outer Join. Blank rows are left at the specified side by joining tables in other side. Other joins are CROSS JOINs, NATURAL JOINs, EQUI JOIN and NON-EQUI JOIN. 21. What is functional Dependency? Functional Dependency is the starting point of normalization. It exists when a relation between two attributes allows you to determine the corresponding attribute's value uniquely. The functional dependency is also known as database dependency and defines as the relationship which occurs when one attribute in a relation uniquely determines another attribute. It is written as A->B which means B is functionally dependent on A. 22. What is a Trigger? A Trigger is a code associated with insert, update or delete operations. The code is executed automatically whenever the associated query is executed on a table. Triggers can be useful to maintain integrity in the database. 23. What is a stored procedure? A stored procedure is like a function that contains a set of operations compiled together. It contains a set of operations that are commonly used in an application to do some common database tasks. 24. What is the difference between Trigger and Stored Procedure? Unlike Stored Procedures, Triggers cannot be called directly. They can only be associated with queries. 25. What is the E-R model? E-R model is a short name for the Entity-Relationship model. This model is based on the real world. It contains necessary objects (known as entities) and the relationship among these objects. In E-R diagram, entities are represented by rectangles, relationships are represented by diamonds, attributes are the characteristics of entities and represented by ellipses, and data flow is represented through a straight line. 26. What is an Entity type? An entity type is specified as a collection of entities, having the same attributes. Entity type typically corresponds to one or several related tables in the database. A characteristic or trait which defines or uniquely identifies the entity is called entity type. For example, a student has student_id, department, and course as its characteristics. 27. What is Weak Entity set? An entity set that doesn't have sufficient attributes to form a primary key is referred to as a weak entity set. The member of a weak entity set is known as a subordinate entity. 28. What are the integrity rules in DBMS? Data integrity is one significant aspect while maintaining the database. So, data integrity is enforced in the database system by imposing a series of rules. Those set of integrity is known as the integrity rules. There are two integrity rules in DBMS: o Entity Integrity: It specifies that "Primary key cannot have a NULL value." o Referential Integrity: It specifies that "Foreign Key can be
either a NULL value or should be the Primary Key value of
other relation 29. Explain ACID properties ACID properties are some basic rules, which has to be satisfied by every transaction to preserve the integrity. These properties and rules are: o ATOMICITY: Atomicity is more generally known as? all or nothing rule.' Which implies all are considered as one unit, and they either run to completion or not executed at all. o CONSISTENCY: This property refers to the uniformity of
the data. Consistency implies that the database is
consistent before and after the transaction. o ISOLATION: This property states that the number of the
transaction can be executed concurrently without leading
to the inconsistency of the database state. o DURABILITY: This property ensures that once the
transaction is committed it will be stored in the non-
volatile memory and system crash can also not affect it anymore. 30. What is the difference between a DELETE command and TRUNCATE command? o DELETE command: DELETE command is used to delete
rows from a table based on the condition that we provide
in a WHERE clause. o DELETE command delete only those rows which are
specified with the WHERE clause.
o DELETE command can be rolled back.
o DELETE command maintain a log, that's why it is slow.
o DELETE use row lock while performing DELETE function.
o TRUNCATE command: TRUNCATE command is used to
remove all rows (complete data) from a table. It is similar to the DELETE command with no WHERE clause. o The TRUNCATE command removes all the rows from the table. o The TRUNCATE command cannot be rolled back. o The TRUNCATE command doesn't maintain a log. That's why it is fast. o TRUNCATE use table log while performing the TRUNCATE function.
31. What is 1NF in the DBMS?
1NF is known as the First Normal Form. This is the easiest form of the normalization process which states that the domain of an attribute should have only atomic values. The objective of this is to remove the duplicate columns that are present in the table. 32. What is 2NF in the DBMS? 2NF is the Second Normal Form. Any table is said to have in the 2NF if it satisfies the following 2 conditions: A table is in the 1NF. Each non-prime attribute of a table is said to be functionally dependent in totality on the primary key. 33. What is 3NF in the DBMS? 3NF is the Third Normal Form. Any table is said to have in the 3NF if it satisfies the following 2 conditions: A table is in the 2NF. Each non-prime attribute of a table is said to be non-transitively dependent on every key of the table. 34. What is BCNF in the DBMS? BCNF is the Boyce Codd Normal Form which is stricter than the 3NF. Any table is said to have in the BCNF if it satisfies the following 2 conditions: A table is in the 3NF. For each of the functional dependencies X->Y that exists, X is the super key of a table. 35. Difference between primary key and unique key and why one should use unique key if it allows only one null ? Primary key: • Only one in a row(tuple). • Never allows null value(only key field). • Unique key identifier and can not be null and must be unique. Unique Key: • Can be more than one unique key in one row. • Unique key can have null values(only single null is allowed). • It can be a candidate key. • Unique key can be null and may not be unique. 36. Explain the basic structure followed in PL/SQL? The basic structure of PL/SQL follows the BLOCK structure. Each PL/SQL code comprises SQL and PL/SQL statement that constitutes a PL/SQL block. Each PL/SQL block consists of 3 sections: • The optional Declaration Section • The mandatory Execution Section • The optional Exception handling Section [DECLARE]
--declaration statements (optional)
BEGIN
--execution statements
[EXCEPTION]
--exception handling statements (optional)
END;
37. What is a PL/SQL cursor?
• A PL/SQL cursor is nothing but a pointer to an area of memory having SQL statements and the information of statement processing. This memory area is called a context area. This special area makes use of a special feature called cursor for the purpose of retrieving and processing more than one row. • In short, the cursor selects multiple rows from the database and these selected rows are individually processed within a program. • There are two types of cursors: ➢ Implicit Cursor: o Oracle automatically creates a cursor while running any of the commands - SELECT INTO, INSERT, DELETE or UPDATE implicitly. o The execution cycle of these cursors is internally handled by Oracle and returns the information and status of the cursor by making use of the cursor attributes- ROWCOUNT, ISOPEN, FOUND, NOTFOUND. ➢ Explicit Cursor: o This cursor is a SELECT statement that was declared explicitly in the declaration block. o The programmer has to control the execution cycle of these cursors starting from OPEN to FETCH and close. o The execution cycle while executing the SQL statement is defined by Oracle along with associating a cursor with it. 38. Differentiate between SQL and PL/SQL. SQL PL/SQL SQL is a natural language meant for the interactive processing of PL/SQL is a procedural data in the database. extension of SQL. PL/SQL supports all features of procedural language such Decision-making and looping are as conditional and looping not allowed in SQL. statements. All SQL statements are executed PL/SQL statements are at a time by the database server executed one block at a time SQL PL/SQL which is why it becomes a time- thereby reducing the network consuming process. traffic. There is no error handling This supports an error mechanism in SQL. handling mechanism.
39. What are the various methods of controlling concurrency?
1. Locking 2. Time stamp Locking data item to prevent multiple transactions from accessing the item concurrently. A time stamp is a unique identifier for each transaction, generated by the system. 40. What are various types of locking techniques? 1. A binary lock 2. Shared/Exclusive lock 3. Two phase locking 41. What is a deadlock? Dead lock occurs when each transaction T in a set of two or more transactions is waiting for some item that is locked by some other transaction T’ in the set. Hence each transaction is in a waiting queue, waiting for one of the other transactions to release the lock on them.
42. What is Serializability in DBMS?
A database may be inconsistent if multiple transactions are running concurrently. Serializability helps to ensure that the data is consistent at all times and the serial schedules are in order. A serial schedule achieves this as a new transaction will start after the other transaction has completed execution. 43. What is Concurrency Control in DBMS? Concurrency control is performed for multiple database operations without them being affected by each other. In large databases where read and write operations are performed, problems in concurrency may occur. So, the main aim of concurrency control is to maintain data integrity. 44. What is a transaction in DBMS? A transaction may be a group of tasks or a single processing unit that cannot be divided further. A transaction can also be considered as a group of tasks where the contents of the database may be updated. 45. What is Tuple in DBMS? A tuple is a single row of a database table that contains all the information of an individual record. It is a single entry in the table also called record or row, having related information. For example, 1 Jason Roy England Batsman Here, the column headings may be a Serial number, Player name, Country and Specialty.