0% found this document useful (0 votes)
11 views2 pages

Bdms Long

The document discusses various database concepts including aggregate functions, SQL characteristics, normalization processes, and triggers. It explains aggregate functions like COUNT, SUM, AVG, MAX, and MIN, along with SQL's ease of use and data types. Additionally, it covers normalization forms (1NF, 2NF, 3NF, BCNF), the ER model, serializability in transaction processing, and deadlock handling techniques.

Uploaded by

sufyan.khan
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)
11 views2 pages

Bdms Long

The document discusses various database concepts including aggregate functions, SQL characteristics, normalization processes, and triggers. It explains aggregate functions like COUNT, SUM, AVG, MAX, and MIN, along with SQL's ease of use and data types. Additionally, it covers normalization forms (1NF, 2NF, 3NF, BCNF), the ER model, serializability in transaction processing, and deadlock handling techniques.

Uploaded by

sufyan.khan
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/ 2

2. What are aggregates functions and different types of aggregate functions? 4.

4. Explain characteristics of SQL and different types of SQL data type? 2. Explain the process of normalization and its various normal forms (1NF, 2NF, 3NF, BCNF).
Ans: An aggregate function or aggregation function is a function where multiple values are Ans: Characteristics of SQL Provide an example for each.
processed together to form a single summary statistic. The different types of aggregate function are: 1.SQL is easy to learn. Ans: Normalization is the process of minimizing redundancy from a relation or set of relations.
1. COUNT FUNCTION: COUNT function is used to Count the number of rows in a database table. 2.SQL is used to access data from relational database management systems. Redundancy in relation may cause insertion, deletion, and update anomalies. So, it helps to
It can work on both numeric and non-numeric data types. COUNT function uses the COUNT(*) 3.SQL can execute queries against the database. minimize the redundancy in relations. Normal forms are used to eliminate or reduce redundancy in
that returns the count of all the rows in a specified table. COUNT(*) considers duplicate and Null. 4.SQL is used to describe the data. database tables.
Syntax 1. COUNT(*) 5.SQL is used to define the data in the database and manipulate it when needed. First Normal Form (1NF): A relation will be 1NF if it contains an atomic value. It states that an
2. or 3. COUNT( [ALL|DISTINCT] expression ) 6.SQL is used to create and drop the database and table. attribute of a table cannot hold multiple values. It must hold only single-valued attribute. First
2. SUM Function: Sum function is used to calculate the sum of all selected columns. It works on 7.SQL is used to create a view, stored procedure, function in a database. normal form disallows the multi-valued attribute, composite attribute, and their combinations.
numeric fields only. 8.SQL allows users to set permissions on tables, procedures, and views. Example: Relation EMPLOYEE is not in 1NF because of multi-valued attribute EMP_PHONE.
Syntax SQL data types can be broadly divided into the following categories.
SUM() or 1.Numeric data types such as: INT, TINYINT, BIGINT, FLOAT, REAL, etc.
SUM( [ALL|DISTINCT] expression ) 2.Date and Time data types such as: DATE, TIME, DATETIME, etc.
3. AVG function: The AVG function is used to calculate the average value of the numeric type. AVG 3.Character and String data types such as: CHAR, VARCHAR, TEXT, etc.
function returns the average of all non-Null values. Syntax AVG() or AVG( [ALL|DISTINCT] 4.Unicode character string data types such as: NCHAR, NVARCHAR, NTEXT, etc.
expression ) 5.Binary data types such as: BINARY, VARBINARY, etc.
4. MAX Function: MAX function is used to find the maximum value of a certain column. This 6.Miscellaneous data types - CLOB, BLOB, XML, CURSOR, TABLE, etc.
function determines the largest value of all selected values of a column.
Syntax MAX() or 1.explain DBMS architecture of DBMS?
MAX( [ALL|DISTINCT] expression ) Ans: A Database stores a lot of critical information to access data quickly and securely. Hence it is Second Normal Form (2NF): In the 2NF, relational must be in 1NF. In the second normal form, all
5. MIN Function: MIN function is used to find the minimum value of a certain column. This important to select the correct architecture for efficient data management. DBMS Architecture helps non-key attributes are fully functional dependent on the primary key Example: A school can store
function determines the smallest value of all selected values of a column. users to get their requests done while connecting to the database. We choose database architecture the data of teachers and the subjects they teach. In a school, a teacher can teach more than one
Syntax MIN() or depending on several factors like the size of the database, number of users, and relationships subject.
MIN( [ALL|DISTINCT] expression ) between the users. There are two types of database models that we generally use, logical model and
physical model. Several types of architecture are there in the database which we will deal with in
the next section. Types:::
3. What are triggers? Explain advantages and disadvantages of triggers. 1-Tier Architecture
Ans: A trigger is a special kind of stored procedure that is activated ("triggered") in response to a 2-Tier Architecture
particular event in a database. trigger is called automatically when a data modification event occurs 3-Tier Architecture
against a table. 1-Tier Architecture
ADVANTAGES OF TRIGGERS In 1-Tier Architecture the database is directly available to the user, the user can directly sit on the
• Triggers set database object rules and roll back if any change does not satisfy those rules. The DBMS and use it that is, the client, server, and Database are all present on the same machine. For
trigger will inspect the data and make changes if necessary. Example: to learn SQL we set up an SQL server and the database on the local system. This enables
• Triggers help us to enforce data integrity. • Triggers help us to validate data before inserted or us to directly interact with the relational database and execute operations. The industry won’t use Third Normal Form (3NF): A relation will be in 3NF if it is in 2NF and not contain any transitive
updated. this architecture they logically go for 2-tier and 3-tier Architecture.2-Tier Architecture partial dependency. 3NF is used to reduce the data duplication. It is also used to achieve the data
• Triggers help us to keep a log of records. • Triggers increase SQL queries' performance because The 2-tier architecture is similar to a basic client-server model. The application at the client end integrity. If there is no transitive dependency for non-prime attributes, then the relation must be in
they do not need to compile each time they are executed. directly communicates with the database on the server side. APIs like ODBC and JDBC are used for third normal form.
• Triggers reduce the client-side code that saves time and effort. this interaction. The server side is responsible for providing query processing and transaction Example:
• Triggers are easy to maintain. DISADVANTAGES OF TRIGGERS management functionalities. On the client side, the user interfaces and application programs are run.
•Triggers are invoked automatically, and their execution is invisible to the user. Therefore, it isn't The application on the client side establishes a connection with the server side to communicate with
easy to troubleshoot what happens in the database layer. the DBMS.
• Triggers may increase the overhead of the database server. An advantage of this type is that maintenance and understanding are easier, and compatible with
• We can define the same trigger action for multiple user actions such as INSERT and UPDATE in existing systems3-Tier Architecture
the same CREATE TRIGGER statement. In 3-Tier Architecture, there is another layer between the client and the server. The client does not
• We can create a trigger in the current database only, but it can reference objects outside the current directly communicate with the server. Instead, it interacts with an application server which further
database. communicates with the database system and then the query processing and transaction management Boyce-Codd Normal Form (BCNF): BCNF is the advance version of 3NF. It is stricter than 3NF. A
takes place. This intermediate layer acts as a medium for the exchange of partially processed data table is in BCNF if every functional dependency X → Y, X is the super key of the table. For BCNF,
between the server and the client. This type of architecture is used in the case of large web the table should be in 3NF, and for every FD, LHS is super key.
applications. Example: Let's assume there is a company where employees work in more than one department.

4. Explain about Boyce Codd normal form with an example.


Ans: Boyce-Codd Normal Form (BCNF) is a stricter version of the Third Normal Form (3NF) and
is used in database normalization to eliminate certain types of anomalies and ensure that a database
schema is well-structured and maintains data integrity. BCNF is particularly concerned with
dependencies that arise from candidate keys.
Example: Let's assume there is a company where employees work in more than one department.
In the above table Functional dependencies are as follows:
EMP_ID → EMP_COUNTRY
EMP_DEPT → {DEPT_TYPE, EMP_DEPT_NO}
Candidate key: {EMP-ID, EMP-DEPT}
The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys.
To convert the given table into BCNF, we decompose it into three tables:
EMP_COUNTRY table:
2.Explain ER model with diagram and its components? Discuss concepts of serializability in transaction processing? How are deadlock handle in transaction system? Describe common deadlock prevention and
ER model stands for the Entity Relationship Model in the database management system (DBMS). It The backbone of the most modern application is the form of DBMS. When we design the form detection techniques?
is the first step of designing to give the flow for a concept. It is the DFD (Data Flow Diagram) properly, then it provides high-performance and relative storage solutions to our application. In this Ans :Deadlock Prevention
requirement of a company. topic, we are going to explain the serializability concept and how this concept affects the DBMS We can prevent a Deadlock by eliminating any of the above four conditions.
It is the basic building block for relational models. Not that much training is required to design the deeply. We also understand the concept of serializability with some examples. Finally, we will Eliminate Mutual Exclusion: It is not possible to dis-satisfy the mutual exclusion because some
database project. It is very easy to convert the E-R model into a relational table or to a normalized conclude this topic with an example of the importance of serializability. resources, such as the tape drive and printer, are inherently non-shareable.
table. Eliminate Hold and wait: Allocate all required resources to the process before the start of its
It is a high-level data model diagram that defines the conceptual view of the database. It acts as a execution, this way hold and wait condition is eliminated but it will lead to low device utilization.
blueprint to implement a database in future. What is Serializability in DBMS? for example, if a process requires a printer at a later time and we have allocated a printer before the
Components of ER diagram In the field of computer science, serializability is a term that is a property of the system that start of its execution printer will remain blocked till it has completed its execution. The process will
The components of ER diagram are as follows − describes how the different process operates the shared data. If the result given by the system is make a new request for resources after releasing the current set of resources. This solution may lead
Entity similar to the operation performed by the system, then in this situation, we call that system to starvation.
Attributes serializable. Here the cooperation of the system means there is no overlapping in the execution of Hold and Wait
Relationship the data. In DBMS, when the data is being written or read then, the DBMS can stop all the other Eliminate No Preemption : Preempt resources from the process when resources are required by
Weak entity processes from accessing the data. other high-priority processes.
Strong entity Eliminate Circular Wait : Each resource will be assigned a numerical number. A process can request
Simple attribute the resources to increase/decrease. order of numbering. For Example, if the P1 process is allocated
Key attribute In the MongoDB developer certificate, the DBMS uses various locking systems to allow the other R5 resources, now next time if P1 asks for R4, R3 lesser than R5 such a request will not be granted,
Composite attribute processes while maintaining the integrity of the data. In MongoDB, the most restricted level for only a request for resources more than R5 will be granted.
Derived attribute serializability is the employee can be restricted by two-phase locking or 2PL. In the first phase of Detection and Recovery: Another approach to dealing with deadlocks is to detect and recover from
Multivalued attributeEntity set the locking level, the data objects are locked before the execution of the operation. When the them when they occur. This can involve killing one or more of the processes involved in the
It is a collection of entities of the same type which share similar properties. For example, a group of transaction has been accomplished, then the lock for the data object is released. This process deadlock or releasing some of the resources they hold.
students in a college and students are an entity set. guarantees that there is no conflict in operation and that all the transaction views the database as a Deadlock Avoidance
Entity is characterised into two types as follows − conflict database. A deadlock avoidance policy grants a resource request only if it can establish that granting the
Strong entity set request cannot lead to a deadlock either immediately or in the future. The kernal lacks detailed
Weak entity set The two-phase locking or 2PL system provides a strong guarantee for the conflict of the database. knowledge about future behavior of processes, so it cannot accurately predict deadlocks. To
Strong entity set facilitate deadlock avoidance under these conditions, it uses the following conservative approach:
The entity types which consist of key attributes or if there are enough attributes for forming a Each process declares the maximum number of resource units of each class that it may require. The
primary key attribute are called a strong entity set. It is represented by a single rectangle. It can reduce the decreased performance and then increase the overhead acquiring capacity and then kernal permits a process to request these resource units in stages- i.e. a few resource units at a time-
For Example, release the lock of the data. As a result, the system allows the constraint serializability for better subject to the maximum number declared by it and uses a worst case analysis technique to check for
Roll no of student performance of the DBMS. This ensures that the final result is the same as some sequential the possibility of future deadlocks. A request is granted only if there is no possibility of deadlocks;
EmpID of employee execution and performs the improvement of the operation that is involved in the database. otherwise, it remains pending until it can be granted. This approach is conservative because a
Weak entity set process may complete its operation without requiring the maximum number of units declared by it.
An entity does not have a primary key attribute and depends on another strong entity via foreign Thus, serializability is the system's property that describes how the different process operates the Resource Allocation Graph
key attribute. It is represented by a double rectangle. shared data. In DBMS, the overall Serializable property is adopted by locking the data during the The resource allocation graph (RAG) is used to visualize the system’s current state as a graph. The
Attributes execution of other processes. Also, serializability ensures that the final result is equivalent to the Graph includes all processes, the resources that are assigned to them, as well as the resources that
It is the name, thing etc. These are the data characteristics of entities or data elements and data sequential operation of the data. each Process requests. Sometimes, if there are fewer processes, we can quickly spot a deadlock in
fields.Types of attributes the system by looking at the graph rather than the tables we use in Banker’s algorithm. Deadlock
The types of attributes in the Entity Relationship (ER) model are as follows − avoidance can also be done with Banker’s Algorithm.
Single value attribute − These attributes contain a single value. For example, age, salary etc. Banker’s Algorithm
Multivalued attribute − They contain more than one value of a single entity. For example, phone Bankers’s Algorithm is a resource allocation and deadlock avoidance algorithm which test all the
numbers. request made by processes for resources, it checks for the safe state, and after granting a request
Composite attribute − The attributes which can be further divided. For example, Name-> First system remains in the safe state it allows the request, and if there is no safe state it doesn’t allow the
name, Middle name, last name request made by the process.
Derived attribute − The attribute that can be derived from others. For example, Date of Inputs to Banker’s Algorithm
Birth.Relationship Max needs of resources by each process.
It is used to describe the relation between two or more entities. It is represented by a diamond Currently, allocated resources by each process.
shape. Max free available resources in the system.
For Example, students study in college and employees work in a department.

You might also like