Skip to main content

Posts

Showing posts with the label Important Queries in SQL

Important Queries in SQL Part 4 #DOTC_Mdb

Important Queries in SQL Part 4. In my previous blogs I discussed about several sql queries which commonly used in SQL and today again also I will discuss about some important queries in SQL . Before that I suggest you to go through my SQL and PL/SQL blogs in archive May and June folder for your understanding.   Also you can see my below previous blogs about Queries in SQL. https://dheeraj60.blogspot.com/2020/07/important-queries-in-sql-part1-dotcmdb.html https://dheeraj60.blogspot.com/2020/07/important-sql-queries-part-2-dotcmdb.html https://dheeraj60.blogspot.com/2020/07/important-queries-in-sql-part3-dotcmdb.html   1. How to Assigning sequential numbers to rows in a table As we know in Oracle we use ROWNUM pseudo column returns a number indicating the order in which Oracle selects the row from a table. In my SQL we use ROW_NUMBER(). Let’s understand with below statement. The below SQL statement or queries uses the ROW_NUMBER() function to assign a sequential number to each row

Important Queries in SQL Part3 #DOTC_Mdb

Important Queries in SQL Part3. In my previous blogs I discussed about several sql queries which commonly used in SQL and today also I will discuss about some important queries in SQL . Before that I suggest you to go through my SQL and PL/SQL blogs in archive May and June folder for your understanding.   Also you can see my below previous blog about Queries in SQL.   https://dheeraj60.blogspot.com/2020/07/important-queries-in-sql-part1-dotcmdb.html https://dheeraj60.blogspot.com/2020/07/important-sql-queries-part-2-dotcmdb.html 1. Self Join Example :   Suppose I have an employee table and need to fetch Employee_name and his Manager_name from one table only. As we know self Join is used to join the table itself . So finding this we need to write below query. Select a.emp_name as Employee,b.emp_name as Manager From Employee a,Employee b where a.emp_id=b.Manager_id; This query is important as we join the table itself and get the requirement. Below is the output of above query in i