Browsed by
Tag: Notes on Database Management System

What is the default “-SORT” order for a SQL

What is the default “-SORT” order for a SQL

ASCENDING In SQL, there’s no default “-SORT” order. Sorting in SQL is explicitly specified using the ORDER BY clause. If you don’t specify an ORDER BY clause, the result set’s order is not guaranteed. However, some database management systems might return results in the order they were inserted or some other internal ordering, but this behavior is not consistent across different systems and should not be relied upon. So, in short, there’s no default “-SORT” order in SQL.

We have an employee salary table, how do we find the second highest from it.

We have an employee salary table, how do we find the second highest from it.

Below Sql Query find the second highest salary SELECT * FROM pcdsEmployeeSalary a WHERE (2=(SELECT COUNT(DISTINCT(b.salary)) FROM pcdsEmployeeSalary b WHERE b.salary>=a.salary)) To find the second highest salary from an employee salary table in a Database Management System (DBMS), you can use a query like this: sql SELECT MAX(salary) AS second_highest_salary FROM employees WHERE salary < (SELECT MAX(salary) FROM employees); This query first finds the maximum salary in the table using MAX(salary). Then, it finds the maximum salary that is less…

Read More Read More

What is Snow Flake Schema design in database? What’s the difference between Star and Snow flake schema

What is Snow Flake Schema design in database? What’s the difference between Star and Snow flake schema

Star schema is good when you do not have big tables in data warehousing. But when tables start becoming really huge it is better to denormalize. When you denormalize star schema it is nothing but snow flake design. For instance below customeraddress table is been normalized and is a child table of Customer table. Same holds true for Salesperson table.

What is “CROSS JOIN”? Orwhat is Cartesian product

What is “CROSS JOIN”? Orwhat is Cartesian product

CROSS JOIN” or “CARTESIAN PRODUCT” combines all rows from both tables. Number of rows will be product of the number of rows in each table. In real life scenario I can not imagine where we will want to use a Cartesian product. But there are scenarios where we would like permutation and combination probably Cartesian would be the easiest way to achieve it.

What is ETL process in Data warehousing? What are the different stages in “Data warehousing

What is ETL process in Data warehousing? What are the different stages in “Data warehousing

ETL (Extraction, Transformation and Loading) are different stages in Data warehousing. Like when we do software development we follow different stages like requirement gathering, designing, coding and testing. In the similar fashion we have for data warehousing. Extraction:- In this process we extract data from the source. In actual scenarios data source can be in many forms EXCEL, ACCESS, Delimited text, CSV (Comma Separated Files) etc. So extraction process handle’s the complexity of understanding the data source and loading it…

Read More Read More

Introduction to RDBMS

Introduction to RDBMS

Introduction Data is meaningful information. Database is a collection of relevant data. DBMS means database management system. DBMS provides the software to manage the database. Following are the operations to be performed on database: insertion, deletion, updation, sorting, searching, traversing, etc. Following are the different types of DBMS: FMS, Hierarchical, DBMS FMS (File Management System) It is simple to create but difficult to manage. No relations are there (like 1-to-1, 1-to-many) Hierarchical System Here data is stored in tree like…

Read More Read More

How to select the first record in a given set of rows

How to select the first record in a given set of rows

Select top 1 * from sales.salesperson To select the first record in a given set of rows in a database management system (DBMS), you can typically use the LIMIT clause in conjunction with the ORDER BY clause to specify the ordering of the rows. The LIMIT clause restricts the number of rows returned by the query, and by combining it with ORDER BY, you can ensure that the first row returned is the one you want. Here’s an example in…

Read More Read More

What is Data Mining

What is Data Mining

Data mining is a concept by which we can analyze the current data from different perspectives and summarize the information in more useful manner. It’s mostly used either to derive some valuable information from the existing data or to predict sales to increase customer market. There are two basic aims of Data mining:- Prediction: – From the given data we can focus on how the customer or market will perform. For instance we are having a sale of 40000 $…

Read More Read More

What is SQL

What is SQL

SQL stands for Structured Query Language.SQL is an ANSI (American National Standards Institute) standard computer language for accessing and manipulating database systems. SQL statements are used to retrieve and update data in a database. SQL stands for Structured Query Language. It’s a standard programming language specifically designed for managing and manipulating relational databases. With SQL, you can perform various operations on databases, such as querying data, inserting new records, updating existing records, and deleting records. It provides a set of…

Read More Read More

What is a self-join

What is a self-join

If we want to join two instances of the same table we can use self-join. A self-join in a database management system (DBMS) is when a table is joined with itself. This can be useful when you want to compare rows within the same table. For example, in a table representing employees, you might use a self-join to find pairs of employees who share the same manager.