Browsed by
Author: priya

What are the advantages of DBMS?

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 The advantages of a Database Management System (DBMS) include: Data Centralization: DBMS allows for centralized control and management of data, ensuring data consistency and integrity across the organization. Data Sharing: Multiple users and applications can access the same data simultaneously, promoting data sharing and collaboration. Data…

Read More Read More

What is a database system?

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. The data will be extracted from the database using DBMS software whenever required. So, the combination of database and DBMS software enables one to store, retrieve and access data with considerate accuracy and security.

What is a database?

What is a database?

A Database is a logical, consistent and organized collection of data that it can easily be accessed, managed and updated. Databases, also known as electronic databases are structured to provide the facility of creation, insertion, updating of the data efficiently and are stored in the form of a file or set of files, on the magnetic disk, tapes and another sort of secondary devices. Database mostly consists of the objects (tables), and tables include of the records and fields. Fields…

Read More Read More

What is DBMS?

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. DBMS is a software in which data is stored in a more secure way as compared to the file-based system. Using DBMS, we can overcome many problems such as- data redundancy, data…

Read More Read More

About RDBMS

About RDBMS

RDBMS It exhibits all relationships. It is very easy to manage the data. In RDBMS data is stored in tabular form. Tables have rows & columns. Rows represent records and column represents fields. To access the data in RDBMS “SQL (Structured Query Language)” is used. Limitations of RDBMS: 1. It is slow as compare to network RDBMS. 2. Redundancy of data to establish the relationship between tables. Different types of RDBMS: ORACLE, SQL Server, Sybase, DB2, MySQL, etc. SQL queries…

Read More Read More

Which will return: Peter and Amanda

Which will return: Peter and Amanda

If you want to find out the number of descendants for a node, all you need is the left_val and right_val of the node for which you want to find the  descendants  count. The formula is No. of descendants = (right_val – left_val -1) /2 So,  for 6 -11 Amanda, (11 – 6 – 1) /2 =  2 descendants for 1-12  Peter, (12 – 1 -1 ) / 2 = 5 descendants. for 3-4   Mary, (4 -3 – 1) / 2 =  0,…

Read More Read More

Which will return Amanda, Ralph, and Jeanne. If you want to get ancestors to a given node say 7-8 Ralph. What SQL query you will write?

Which will return Amanda, Ralph, and Jeanne. If you want to get ancestors to a given node say 7-8 Ralph. What SQL query you will write?

SELECT * FROM employee WHERE left_val < 7 and right_val > 8 WHERE ORDER BY left_val ASC; To retrieve ancestors of a given node in a hierarchical structure stored in a database using SQL, you typically use recursive queries, which are supported by some relational database management systems (RDBMS) like PostgreSQL, SQL Server, and Oracle. Assuming you’re using a database system that supports recursive queries, here’s an example SQL query: sql WITH RECURSIVE Ancestors AS ( SELECT id, parent_id, name…

Read More Read More

Write SQL query as mentioned below: you can see the numbers indicate the relationship between each node.

Write SQL query as mentioned below: you can see the numbers indicate the relationship between each node.

As you can see the numbers indicate the relationship between each node. All left values greater than 6 and right values less than 11 are descendants of  6-11 (i.e Id: 3 Amanda). Now If you want to extract out the 2-6 sub-tree for Amanda. What SQL query you will write? SELECT * FROM employee WHERE left_val BETWEEN 6 and 11 ORDER BY left_val ASC; To extract the sub-tree rooted at the node with ID 2-6 for Amanda, you would typically…

Read More Read More

Is there any other way to to store tree structure in a relational database

Is there any other way to to store tree structure in a relational database

Yes, it can be done using the “modified preorder tree traversal” as described below.As shown in the previous diagram above, each node is marked with a left and right numbers using a modified preorder traversalas shown above. This can be represented in a database table as shown below. Yes, there are alternative methods for storing tree structures in a relational database. One common approach is called the “adjacency list model,” where each node in the tree has a reference to its parent node. Another approach is the…

Read More Read More

How will you find out the superior for an employee whose emp_id is 3

How will you find out the superior for an employee whose emp_id is 3

You can use a self-join to find the manager of an employee whose emp_id is 3 Select e.emp_id,e.emp_name, title Fromemployee e, employee s where e.superior_emp_id = s.employee_idand e.emp_id = 3 This should return: 1, Peter, CIO To find the superior for an employee with emp_id 3 in a database management system (DBMS), you would typically execute a SQL query that retrieves the superior’s information based on the hierarchical relationship stored in the database. Assuming there’s a table named “employees” with columns like…

Read More Read More