Home
Search results “Subpartition oracle select”
SQL Partition By Explained
 
06:42
Using Oracle's SQL, I'll explain how to use Partition By. This will be similar in other SQL engines that have the Partition By keyword.
Views: 25250 Pretty Printed
Oracle Partition By clause, Oracle Analytic Functions tutorial
 
09:09
More about analytic functions, visit http://www.learn-with-video-tutorials.com Oracle Analytic Functions and Over By Partition clause enable calculating cumulative and moving aggregates returning multiple rows for each group.
sub partitioning in oracle  or composite partitioning in Oracle RANGE-LIST, RANGE-HASH
 
07:24
sub partitioning in oracle or composite partitioning in Oracle SQL Tutorial SQL Tutorial for beginners PLSQL Tutorial PLSQL Tutorial for beginners PL/SQL Tutorial PL SQL Tutorial PL SQL Tutorial for beginners PL/SQL Tutorial for beginners Oracle SQL Tutorial
Views: 442 TechLake
Over clause in SQL Server
 
09:13
over partition by in sql server 2008 sql server over clause partition partition by clause in sql server 2008 over partition by clause in sql In this video we will discuss the power and use of Over clause in SQL Server. The OVER clause combined with PARTITION BY is used to break up data into partitions. Syntax : function (...) OVER (PARTITION BY col1, Col2, ...) The specified function operates for each partition. For example : COUNT(Gender) OVER (PARTITION BY Gender) will partition the data by GENDER i.e there will 2 partitions (Male and Female) and then the COUNT() function is applied over each partition. Any of the following functions can be used. Please note this is not the complete list. COUNT(), AVG(), SUM(), MIN(), MAX(), ROW_NUMBER(), RANK(), DENSE_RANK() etc. Example : SQl Script to create Employees table Create Table Employees ( Id int primary key, Name nvarchar(50), Gender nvarchar(10), Salary int ) Go Insert Into Employees Values (1, 'Mark', 'Male', 5000) Insert Into Employees Values (2, 'John', 'Male', 4500) Insert Into Employees Values (3, 'Pam', 'Female', 5500) Insert Into Employees Values (4, 'Sara', 'Female', 4000) Insert Into Employees Values (5, 'Todd', 'Male', 3500) Insert Into Employees Values (6, 'Mary', 'Female', 5000) Insert Into Employees Values (7, 'Ben', 'Male', 6500) Insert Into Employees Values (8, 'Jodi', 'Female', 7000) Insert Into Employees Values (9, 'Tom', 'Male', 5500) Insert Into Employees Values (10, 'Ron', 'Male', 5000) Go Write a query to retrieve total count of employees by Gender. Also in the result we want Average, Minimum and Maximum salary by Gender. This can be very easily achieved using a simple GROUP BY query as show below. SELECT Gender, COUNT(*) AS GenderTotal, AVG(Salary) AS AvgSal, MIN(Salary) AS MinSal, MAX(Salary) AS MaxSal FROM Employees GROUP BY Gender What if we want non-aggregated values (like employee Name and Salary) in result set along with aggregated values You cannot include non-aggregated columns in the GROUP BY query. SELECT Name, Salary, Gender, COUNT(*) AS GenderTotal, AVG(Salary) AS AvgSal, MIN(Salary) AS MinSal, MAX(Salary) AS MaxSal FROM Employees GROUP BY Gender The above query will result in the following error : Column 'Employees.Name' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause One way to achieve this is by including the aggregations in a subquery and then JOINING it with the main query as shown in the example below. Look at the amount of T-SQL code we have to write. SELECT Name, Salary, Employees.Gender, Genders.GenderTotals, Genders.AvgSal, Genders.MinSal, Genders.MaxSal FROM Employees INNER JOIN (SELECT Gender, COUNT(*) AS GenderTotals, AVG(Salary) AS AvgSal, MIN(Salary) AS MinSal, MAX(Salary) AS MaxSal FROM Employees GROUP BY Gender) AS Genders ON Genders.Gender = Employees.Gender Better way of doing this is by using the OVER clause combined with PARTITION BY SELECT Name, Salary, Gender, COUNT(Gender) OVER(PARTITION BY Gender) AS GenderTotals, AVG(Salary) OVER(PARTITION BY Gender) AS AvgSal, MIN(Salary) OVER(PARTITION BY Gender) AS MinSal, MAX(Salary) OVER(PARTITION BY Gender) AS MaxSal FROM Employees Text version of the video http://csharp-video-tutorials.blogspot.com/2015/09/over-clause-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/09/over-clause-in-sql-server_29.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 80084 kudvenkat
Advanced SQL Queries in Oracle and SQL Server - What is PARTITION BY?
 
05:24
This video clip, on the PARTITION BY Clause used with analytic functions, is taken from my www.pluralsight.com course "Advanced SQL Queries in Oracle and SQL Server". Click here to learn more about this course: http://www.pluralsight.com/courses/adv-sql-queries-oracle-sql-server?utm_source=youtube&utm_medium=video&utm_campaign=authordemo.
Views: 5320 sheepsqueezersYT
Oracle Optimization - Table Partitions
 
15:07
Oracle optimization: create table partitions and Index-Organized Table. Other lessons, visit http://www.learn-with-video-tutorials.com/plsql-oracle-optimization
SQL tutorial 51: DECODE function in Oracle Database By Manish Sharma (RebellionRider)
 
05:04
SQL Tutorial 51 Decode function in Oracle Database. ● What Is DECODE() ● DECODE ( ) vs CASE ● Syntax of DECODE() ● Query 1. String Matching using DECODE() ● Query 2. DECODE() comparing values form the COLUMN of the table Celebrating 1000 subscribers. Thanks a lot guys for all your love and support. ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog: ------------------------------------------------------------------------- Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=kb4rc1 -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the first one to see my videos! -------------------------------------------------------------------------- Amazon Wishlist: http://bit.ly/wishlist-amazon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at [email protected] Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 32678 Manish Sharma
01 Overview of table Partition in oracle
 
07:26
Partitioning enhances the performance, manageability, and availability of a wide variety of applications and helps reduce the total cost of ownership for storing large amounts of data. Partitioning allows tables, indexes, and index-organized tables to be subdivided into smaller pieces, enabling these database objects to be managed and accessed at a finer level of granularity. Oracle provides a rich variety of partitioning strategies and extensions to address every business requirement. Moreover, since it is entirely transparent, partitioning can be applied to almost any application without the need for potentially expensive and time consuming application changes. Partitioning allows a table, index, or index-organized table to be subdivided into smaller pieces, where each piece of such a database object is called a partition. Each partition has its own name, and may optionally have its own storage characteristics. From the perspective of a database administrator, a partitioned object has multiple pieces that can be managed either collectively or individually. This gives the administrator considerable flexibility in managing partitioned objects. However, from the perspective of the application, a partitioned table is identical to a non-partitioned table; no modifications are necessary when accessing a partitioned table using SQL queries and DML statements. Partitioning Key ======================== Each row in a partitioned table is unambiguously assigned to a single partition. The partitioning key is comprised of one or more columns that determine the partition where each row will be stored. Oracle automatically directs insert, update, and delete operations to the appropriate partition through the use of the partitioning key. When to Partition a Table ========================== Here are some suggestions for when to partition a table: Tables greater than 2 GB should always be considered as candidates for partitioning. Tables containing historical data, in which new data is added into the newest partition. A typical example is a historical table where only the current month's data is updatable and the other 11 months are read only. When the contents of a table need to be distributed across different types of storage devices. When to Partition an Index ============================= Here are some suggestions for when to consider partitioning an index: Avoid rebuilding the entire index when data is removed. Perform maintenance on parts of the data without invalidating the entire index. Reduce the impact of index skew caused by an index on a column with a monotonically increasing value. Partitioned Index-Organized Tables =================================== Partitioned index-organized tables are very useful for providing improved performance, manageability, and availability for index-organized tables. For partitioning an index-organized table: ============================================ Partition columns must be a subset of the primary key columns Secondary indexes can be partitioned (both locally and globally) OVERFLOW data segments are always equi-partitioned with the table partitions See Also: Oracle Database Concepts for more information about index-organized tables System Partitioning System partitioning enables application-controlled partitioning without having the database controlling the data placement. The database simply provides the ability to break down a table into partitions without knowing what the individual partitions are going to be used for. All aspects of partitioning have to be controlled by the application. For example, an insertion into a system partitioned table without the explicit specification of a partition will fail. System partitioning provides the well-known benefits of partitioning (scalability, availability, and manageability), but the partitioning and actual data placement are controlled by the application. See Also: Oracle Database Data Cartridge Developer's Guide for more information about system partitioning Partitioning for Information Lifecycle Management Information Lifecycle Management (ILM) is concerned with managing data during its lifetime. Partitioning plays a key role in ILM because it enables groups of data (that is, partitions) to be distributed across different types of storage devices and managed individually.
Views: 6702 OnLinE ReSoUrCe
Year-to-Date using Partition By with Windowing - SQL Training Online
 
05:43
You can use the Partition By Function in SQL Server to get a Year-to-Date and Month-to_Date calculation. In this video I show you how to create a Year-to-Date value using the Windowing Partition By Function in TSQL. READ THE ORIGINAL ARTICLE WITH SQL SCRIPTS HERE http://www.sqltrainingonline.com/year-to-date-using-the-partition-by-function-with-windowing-in-sql-server/ YOUTUBE NEWS UPDATES http://www.youtube.com/user/sqltrainingonline VISIT SQLTRAININGONLINE.COM FOR TONS MORE VIDEO NEWS & TIPS http://www.sqltrainingonline.com SUBSCRIBE FOR OTHER SQL TIPS AND NEWS! http://www.youtube.com/subscription_center?add_user=sqltrainingonline SUBSCRIBE TO OUR EMAIL LIST! http://www.sqltrainingonline.com LET'S CONNECT! Google+: http://gplus.to/SQLTrainingOnline Facebook: http://facebook.com/SQLTrainingOnline Twitter: http://twitter.com/sql_by_joey Linkedin: http://linkedin.com/in/joeyblue SQLTrainingOnline: http://www.sqltrainingonline.com
Views: 1856 Joey Blue
Understanding the use of GROUP BY clause in SQL
 
04:39
Join discussion: http://www.techtud.com/video-lecture/understanding-group-clause-sql IMPORTANT LINKS: 1) Official Website: http://www.techtud.com/ 2) Virtual GATE: http://virtualgate.in/login/index.php Both of the above mentioned platforms are COMPLETELY FREE, so feel free to Explore, Learn, Practice & Share! Our Social Media Links: Facebook Page: https://www.facebook.com/techtuduniversity Facebook Group: https://www.facebook.com/groups/virtualgate Google+ Page: https://plus.google.com/+techtud/posts Last but not the least, SUBSCRIBE our YouTube channel to stay updated about the regularly uploaded new videos.
Views: 59952 Techtud
PL/SQL tutorial 16: Table Auditing using DML Triggers in Oracle PL/SQL
 
09:55
Learn Table Auditing using DML Triggers in Oracle Database and Increase the level of security by keep an eye on user tempering your table data. ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : http://bit.ly/table-auditing Previous Tutorial ► DML Triggers with Examples https://youtu.be/-OR7zLzCh_I ► Select-Into Statement: https://youtu.be/F5eMJhwmCQs ►Sysdate Blog : http://bit.ly/sysdate-in-oracle-by-rebellionrider ------------------------------------------------------------------------- ►►►Let's Get Free Uber Cab◄◄◄ Use Referral Code UberRebellionRider and get $20 free for your first ride. ------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 65829 Manish Sharma
T-SQL: Over() and Partition By
 
04:17
Show how to use OVER and PARTITION BY to get groups of data with aggregation.
Views: 4639 MidnightDBA
SQL Advanced - SELECT queries (part 1)
 
13:56
Video showing more advanced features of a SELECT query in SQL focusing mainly on how to query data from multiple tables that are linked by a relationship as well as how to sort the data and find unique data. Part 2 - https://www.youtube.com/watch?v=2YMSUK_BVZw Part 3 - https://www.youtube.com/watch?v=4lgHnlM_U5w Part 4 - https://www.youtube.com/watch?v=ASfbsIRS1t0 Part 5 - https://www.youtube.com/watch?v=Srj6v8St3M0
Views: 16927 Mr Long IT & CAT
ORACLE Analytic Functions for Data Warehousing 2/ Arabic
 
12:32
ORACLE Analytic Functions for Data Warehousing 2/ Arabic FIRST_VALUE last_VALUE row_number() --FIRST_VALUE and LAST_VALUE Analytic Functions select EMPLOYEE_ID, FIRST_NAME, HIRE_DATE from employees order by hire_date; select EMPLOYEE_ID, FIRST_NAME, HIRE_DATE , min(HIRE_DATE) over ( ) first_HIRE_DATE from employees select EMPLOYEE_ID, FIRST_NAME, HIRE_DATE , FIRST_VALUE(HIRE_DATE) over ( ) first_HIRE_DATE from employees order by hire_date; select EMPLOYEE_ID, FIRST_NAME, HIRE_DATE , max(HIRE_DATE ) over ( ) last_HIRE_DATE from employees select EMPLOYEE_ID, FIRST_NAME, HIRE_DATE , last_VALUE(HIRE_DATE ) over ( ) last_HIRE_DATE from employees order by HIRE_DATE drop table student_exam_result; CREATE TABLE student_exam_result (student_id number, exame_name varchar2(100), exame_try number, exame_results number ); insert into student_exam_result values(1,'calcluas',1,50); insert into student_exam_result values(1,'calcluas',2,66); insert into student_exam_result values(1,'calcluas',3,20); insert into student_exam_result values(2,'calcluas',1,66); insert into student_exam_result values(2,'calcluas',2,null); insert into student_exam_result values(2,'calcluas',3,7); insert into student_exam_result values(3,'calcluas',1,50); insert into student_exam_result values(3,'calcluas',2,98); insert into student_exam_result values(3,'calcluas',3,null); select * from student_exam_result select student_id, exame_name,exame_try,exame_results, last_value(exame_results) IGNORE NULLS over (PARTITION BY student_id, exame_name ) last_grade from student_exam_result order by student_id, exame_name, exame_try select student_id, exame_name,exame_try,exame_results, last_value(exame_results) IGNORE NULLS over (PARTITION BY student_id, exame_name ) last_grade, max(exame_results) over (PARTITION BY student_id, exame_name ) max_grade, avg(exame_results) over (PARTITION BY student_id, exame_name ) avg_grade from student_exam_result order by student_id, exame_name, exame_try ------------------------ select employee_id,first_name ,row_number() over(order by employee_id ) from employees select employee_id,first_name ,rownum from employees select employee_id,first_name ,department_id, row_number() over(partition by department_id order by employee_id ) from employees
Views: 556 khaled alkhudari
10. SELECT command with WHERE condition
 
10:15
In this video you will learn how to execute SELECT commands with WHERE condition. I will show you by executing these command and you will understand it easily. For Support =========== Email: [email protected] Contact Form: http://www.learninhindi.com/home/contact Our Social Media ================ Facebook: https://www.facebook.com/LearnInHindi Twitter: https://twitter.com/LearnInHindi For Training & Videos ===================== For more videos and articles visit: http://www.learninhindi.com Free Java Programming In Hindi Course ===================================== https://www.youtube.com/playlist?list=PLOZ3jentlCDAwwhMyoLISrxkXTADGp7PH Free Oracle PL/SQL Programming In Hindi Course ============================================== https://www.youtube.com/playlist?list=PLB5DA82419C2D99B6 Free C Programming In Hindi Course ================================== https://www.youtube.com/playlist?list=PLOZ3jentlCDAxKpBLMWogxSdy6BZcsAJq Trips & Tricks Channel ====================== https://www.youtube.com/channel/UCGmLfkuCo-3lHHJXRJ9HUMw Programming in Hindi Channel ============================ https://www.youtube.com/channel/UCudElIDgwNrybeAvXIy1HZQ
Views: 53213 ITORIAN
Oracle SQL: Using the select statement by AskTheOracle.net
 
08:10
Learn the basics of the Oracle SQL SELECT statement in just a few minutes - including how to select multiple columns, how to restrict the rows retrieved and how to change the values of columns as you retrieve them. For more Oracle tutorials, see our website at http://www.asktheoracle.net
Views: 1051 asktheoracle1
SQL Server interview question :- Explain RowNumber,Partition,Rank and DenseRank ?
 
10:50
For more such videos visit http://www.questpond.com See our other Step by Step video series below :- Learn SQL Server Step by Step in 16 hours:- http://tinyurl.com/ja4zmwu Learn Angular tutorial for beginners https://tinyurl.com/ycd9j895 Learn MVC Core step by step :- http://tinyurl.com/y9jt3wkv Learn MVC 5 Step by Step in 16 hours:- https://goo.gl/dmdakg Learn MSBI Step by Step in 32 hours:- https://goo.gl/TTpFZN Learn Xamarin Mobile Programming Step by Step :- https://goo.gl/WDVFuy Learn Design Pattern Step by Step in 8 hours:- https://goo.gl/eJdn0m Learn C# Step by Step in 100 hours :- https://goo.gl/FNlqn3 Learn Data structures & algorithm in 8 hours :-https://tinyurl.com/ybx29c5s Learn Javascript in 2 hours :- http://tinyurl.com/zkljbdl Learn SharePoint Step by Step in 8 hours:- https://goo.gl/XQKHeP Learn TypeScript in 45 Minutes :- https://goo.gl/oRkawI Learn webpack in 50 minutes:- https://goo.gl/ab7VJi Learn Visual Studio code in 10 steps for beginners:- https://tinyurl.com/lwgv8r8 Learn Tableau step by step :- https://tinyurl.com/kh6ojyo SQL Server interview question :- Explain RowNumber,Partition,Rank and DenseRank ? We are also distributing a 100 page Ebook "Sql Server Interview Questions". If you want this ebook please share this video in your facebook/twitter/linkedin account and email us on [email protected] with the shared link and we will email you the PDF.
ORACLE Analytic Functions for Data Warehousing 1/ Arabic
 
16:59
ORACLE Analytic Functions for Data Warehousing 1/ Arabic --analytic functions allow developers to perform tasks in SQL that were previously confined to procedural languages. -- let's start by aggregate functions ( sum, avg, count,...) select * from EMPLOYEES; select avg(salary) from employees; select DEPARTMENT_ID, avg(salary) from employees group by DEPARTMENT_ID order by 1 /* Analytic functions also operate on subsets of rows, similar to aggregate functions in GROUP BY queries, but they do not reduce the number of rows returned by the query */ select avg(salary) from employees; select employee_id, first_name,salary,(select avg(salary) from employees) avg_sal from EMPLOYEES; --analytic_function([ arguments ]) OVER (analytic_clause) --The analytic_clause breaks down into the following optional elements. --[ query_partition_clause ] [ order_by_clause [ windowing_clause ] ] select employee_id, first_name,salary, avg(salary) over() avg_sal from EMPLOYEES; select employee_id, first_name,salary, avg(salary) over( order by EMPLOYEE_ID ) from EMPLOYEES; select DEPARTMENT_ID, avg(salary) from employees group by DEPARTMENT_ID order by 1 select employee_id, first_name,salary,DEPARTMENT_ID, avg(salary) over(PARTITION BY DEPARTMENT_ID) avg_sal_dept from EMPLOYEES; select employee_id, first_name,salary,DEPARTMENT_ID, avg(salary) over(PARTITION BY DEPARTMENT_ID order by employee_id ) from EMPLOYEES drop table concan_card; create table concan_card ( rec_serial number primary key, game_name varchar2(100), game_round number, player_name varchar2(100), game_round_score number ); insert into concan_card values(1,'GAME1',1,'ahmed', -60); insert into concan_card values(2,'GAME1',1,'khaled', 200); insert into concan_card values(3,'GAME1',1,'ali', 30); insert into concan_card values(4,'GAME1',2,'ahmed', 10); insert into concan_card values(5,'GAME1',2,'khaled', -30); insert into concan_card values(6,'GAME1',2,'ali', 100); insert into concan_card values(7,'GAME1',3,'ahmed', -30); insert into concan_card values(8,'GAME1',3,'khaled', 100); insert into concan_card values(9,'GAME1',3,'ali', 6); select * from concan_card select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY player_name order by player_name,game_round ) from concan_card select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY player_name order by rec_serial ) from concan_card select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY game_name,player_name order by rec_serial ) from concan_card insert into concan_card values(10,'GAME2',1,'ahmed', -60); insert into concan_card values(11,'GAME2',1,'khaled', 200); insert into concan_card values(12,'GAME2',1,'ali', 30); insert into concan_card values(13,'GAME2',2,'ahmed', 10); insert into concan_card values(14,'GAME2',2,'khaled', -30); insert into concan_card values(15,'GAME2',2,'ali', 100); insert into concan_card values(16,'GAME2',3,'ahmed', -30); insert into concan_card values(17,'GAME2',3,'khaled', 100); insert into concan_card values(18,'GAME2',3,'ali', 6); select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY player_name order by player_name,game_round ) from concan_card select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY player_name order by rec_serial ) from concan_card select rec_serial,game_name ,game_round,player_name, game_round_score, sum(game_round_score) over ( PARTITION BY game_name,player_name order by rec_serial ) from concan_card
Views: 3798 khaled alkhudari
How to return multiple values from a function in oracle pl/sql ? (without using out parameter)
 
14:19
This video demonstrates how a function can return multiple values to the calling environment, but without using multiple out parameters, the video shows an example on how we can create a object, a nested table based on the object and then returning the nested table type from the function.
Views: 17004 Kishan Mashru
Rank and Dense Rank in SQL Server
 
10:08
rank and dense_rank example difference between rank and dense_rank with example rank vs dense_rank in sql server 2008 sql server difference between rank and dense_rank In this video we will discuss Rank and Dense_Rank functions in SQL Server Rank and Dense_Rank functions Introduced in SQL Server 2005 Returns a rank starting at 1 based on the ordering of rows imposed by the ORDER BY clause ORDER BY clause is required PARTITION BY clause is optional When the data is partitioned, rank is reset to 1 when the partition changes Difference between Rank and Dense_Rank functions Rank function skips ranking(s) if there is a tie where as Dense_Rank will not. For example : If you have 2 rows at rank 1 and you have 5 rows in total. RANK() returns - 1, 1, 3, 4, 5 DENSE_RANK returns - 1, 1, 2, 3, 4 Syntax : RANK() OVER (ORDER BY Col1, Col2, ...) DENSE_RANK() OVER (ORDER BY Col1, Col2, ...) RANK() and DENSE_RANK() functions without PARTITION BY clause : In this example, data is not partitioned, so RANK() function provides a consecutive numbering except when there is a tie. Rank 2 is skipped as there are 2 rows at rank 1. The third row gets rank 3. DENSE_RANK() on the other hand will not skip ranks if there is a tie. The first 2 rows get rank 1. Third row gets rank 2. SELECT Name, Salary, Gender, RANK() OVER (ORDER BY Salary DESC) AS [Rank], DENSE_RANK() OVER (ORDER BY Salary DESC) AS DenseRank FROM Employees RANK() and DENSE_RANK() functions with PARTITION BY clause : Notice when the partition changes from Female to Male Rank is reset to 1 SELECT Name, Salary, Gender, RANK() OVER (PARTITION BY Gender ORDER BY Salary DESC) AS [Rank], DENSE_RANK() OVER (PARTITION BY Gender ORDER BY Salary DESC) AS DenseRank FROM Employees Use case for RANK and DENSE_RANK functions : Both these functions can be used to find Nth highest salary. However, which function to use depends on what you want to do when there is a tie. Let me explain with an example. If there are 2 employees with the FIRST highest salary, there are 2 different business cases 1. If your business case is, not to produce any result for the SECOND highest salary, then use RANK function 2. If your business case is to return the next Salary after the tied rows as the SECOND highest Salary, then use DENSE_RANK function Since we have 2 Employees with the FIRST highest salary. Rank() function will not return any rows for the SECOND highest Salary. WITH Result AS ( SELECT Salary, RANK() OVER (ORDER BY Salary DESC) AS Salary_Rank FROM Employees ) SELECT TOP 1 Salary FROM Result WHERE Salary_Rank = 2 Though we have 2 Employees with the FIRST highest salary. Dense_Rank() function returns, the next Salary after the tied rows as the SECOND highest Salary WITH Result AS ( SELECT Salary, DENSE_RANK() OVER (ORDER BY Salary DESC) AS Salary_Rank FROM Employees ) SELECT TOP 1 Salary FROM Result WHERE Salary_Rank = 2 You can also use RANK and DENSE_RANK functions to find the Nth highest Salary among Male or Female employee groups. The following query finds the 3rd highest salary amount paid among the Female employees group WITH Result AS ( SELECT Salary, Gender, DENSE_RANK() OVER (PARTITION BY Gender ORDER BY Salary DESC) AS Salary_Rank FROM Employees ) SELECT TOP 1 Salary FROM Result WHERE Salary_Rank = 3 AND Gender = 'Female' Text version of the video http://csharp-video-tutorials.blogspot.com/2015/10/rank-and-denserank-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/10/rank-and-denserank-in-sql-server_1.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 69902 kudvenkat
Select Top N Query
 
02:22
http://zerotoprotraining.com Select Top N Query Category: Oracle SQL Tags: Select Top N Query
Views: 1945 HandsonERP
13.45 OVER, PARTITION BY
 
08:17
Komplette Liste der Videos und zusätzliches Material auf http://datenbankenlernen.de Informatik, Uni Saarland: Bachelor: http://www.cs.uni-saarland.de/index.php?id=52&L=1&source=1345 Master: http://www.cs.uni-saarland.de/index.php?id=132&L=1&source=1345 Ph.D./Grad School: http://gradschool.cs.uni-saarland.de/&source=1345
Oracle Hints Tutorial for improving performance
 
10:35
Oracle Hints Tutorial for improving performance APPEND PARALLEL JOIN INDEX NO_INDEX SELECT /*+ FIRST_ROWS(10) */ * FROM emp WHERE deptno = 10; SELECT /*+ ALL_ROWS */ * FROM emp WHERE deptno = 10; SELECT /*+ NO_INDEX(emp emp_dept_idx) */ * FROM emp, dept WHERE emp.deptno = dept.deptno; SELECT /*+ INDEX(e,emp_dept_idx) */ * FROM emp e WHERE e.deptno = 10; -- SELECT /*+ INDEX(scott.emp,emp_dept_idx) */ * FROM scott.emp; SELECT /*+ AND_EQUAL(e,emp_dept_idx) */ * FROM emp e; SELECT /*+ INDEX_JOIN(e,emp_dept_idx) */ * FROM emp e; SELECT /*+ PARALLEL_INDEX(e,emp_dept_idx , 8) */ * FROM emp e; SELECT /*+ LEADING (dept) */ * FROM emp, dept WHERE emp.deptno = dept.deptno; SELECT /*+ PARALLEL(8) CACHE (e) FULL (e) */ * FROM emp e ; SELECT /*+ PARALLEL FULL (e) */ * FROM emp e ; SELECT /*+ PARALLEL USE_MERGE (emp dept) */ * FROM emp, dept WHERE emp.deptno = dept.deptno; -- SORT Merge Join SELECT /*+ PARALLEL USE_HASH (emp dept) */ * FROM emp, dept WHERE emp.deptno = dept.deptno; -- Hash Join SELECT /*+ PARALLEL */ * FROM emp e ; INSERT /*+ APPEND */ INTO mytmp select /*+ CACHE (e) */ *from emp e; commit;
Views: 4970 TechLake
Creating range partition in Oracle 12c - Part 1
 
11:32
Partition makes a table access faster in case of very large table. In this tutorial we have tried to demonstrate the range partition on date.
Views: 98 Subhroneel Ganguly
SQL tutorial 62: Indexes In Oracle Database By Manish Sharma RebellionRider
 
04:03
Watch and learn concepts of SQL Index In Oracle Database. In this tutorial you will learn about B-Tree Index and Function based Index. ------------------------------------------------------------------------ ►►►LINKS◄◄◄ Blog : Previous Tutorial ► ------------------------------------------------------------------------- ►►►Help Me In Getting A Job◄◄◄ ►Help Me In Getting A Good Job By Connecting With Me on My LinkedIn and Endorsing My Skills. All My Contact Info is Down Below. You Can Also Refer Me To Your Company Thanks ------------------------------------------------------------------------- Copy Cloud referral link || Use this link to join copy cloud and get 20GB of free storage https://copy.com?r=kb4rc1 -------------------------------------------------------------------------- ►Make sure you SUBSCRIBE and be the 1st one to see my videos! -------------------------------------------------------------------------- Amazon Wishlist: http://bit.ly/wishlist-amazon ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ►►►Find me on Social Media◄◄◄ Follow What I am up to as it happens on https://twitter.com/rebellionrider https://www.facebook.com/imthebhardwaj http://instagram.com/rebellionrider https://plus.google.com/+Rebellionrider http://in.linkedin.com/in/mannbhardwaj/ http://rebellionrider.tumblr.com/ http://www.pinterest.com/rebellionrider/ You can also Email me at for E-mail address please check About section Please please LIKE and SHARE my videos it makes me happy. Thanks for liking, commenting, sharing and watching more of our videos This is Manish from RebellionRider.com ♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
Views: 39456 Manish Sharma
How to use partitioning to improve performance of large tables
 
42:49
In this video we cover in much more detail the improvement in performance that can be achieved by using partitioning. MS SQL server databases can scale well using this feature. We cover how partitioning a table gives similar performance as a single table with a clustered index, we then explore how adding NC index improve performance of the heap table as well as the partitioned table.
Views: 17412 Jayanth Kurup
LAST VALUE function in SQL Server
 
05:35
last_value function in sql server 2008 sql server last_value function returns incorrect data sql server last_value function example sql server last_value function with partition example LAST_VALUE function in SQL Server In this video we will discuss LAST_VALUE function in SQL Server. LAST_VALUE function Introduced in SQL Server 2012 Retrieves the last value from the specified column ORDER BY clause is required PARTITION BY clause is optional ROWS or RANGE clause is optional, but for it to work correctly you may have to explicitly specify a value Syntax : LAST_VALUE(Column_Name) OVER (ORDER BY Col1, Col2, ...) LAST_VALUE function not working as expected : In the following example, LAST_VALUE function does not return the name of the highest paid employee. This is because we have not specified an explicit value for ROWS or RANGE clause. As a result it is using it's default value RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW. SELECT Name, Gender, Salary, LAST_VALUE(Name) OVER (ORDER BY Salary) AS LastValue FROM Employees LAST_VALUE function working as expected : In the following example, LAST_VALUE function returns the name of the highest paid employee as expected. Notice we have set an explicit value for ROWS or RANGE clause to ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING This tells the LAST_VALUE function that it's window starts at the first row and ends at the last row in the result set. SELECT Name, Gender, Salary, LAST_VALUE(Name) OVER (ORDER BY Salary ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS LastValue FROM Employees LAST_VALUE function example with partitions : In the following example, LAST_VALUE function returns the name of the highest paid employee from the respective partition. SELECT Name, Gender, Salary, LAST_VALUE(Name) OVER (PARTITION BY Gender ORDER BY Salary ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS LastValue FROM Employees Text version of the video http://csharp-video-tutorials.blogspot.com/2015/10/lastvalue-function-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/10/lastvalue-function-in-sql-server_9.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html Full SQL Server Course https://www.youtube.com/playlist?list=PL4cyC4G0M1RQ_Rm52cQ4CcOJ_T_HXeMB4 All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 31296 kudvenkat
Oracle Database 12c: Partitioning Improvements with Tom Kyte
 
08:08
Tom Kyte introduces the new partitioning improvements in Oracle Database 12c, followed by a demo of global index maintenance. For more information: "Asynchronous Global Index Maintenance for Dropping and Truncating Partitions" http://www.oracle.com/pls/topic/lookup?ctx=db121&id=VLDBG14107 "Changes for Very Large Databases and Partitioning in Oracle Database 12c Release 1" http://www.oracle.com/pls/topic/lookup?ctx=db121&id=VLDBG14100 "ALTER INDEX COALESCE Clause" http://www.oracle.com/pls/topic/lookup?ctx=db121&id=SQLRF52782 "DBMS_PART.CLEANUP_GIDX Procedure" http://www.oracle.com/pls/topic/lookup?ctx=db121&id=ARPLS74409
Views: 12732 OracleDBVision
ORACLE SQL AND PL/SQL INTERVIEW QUESTION : DELETE DUPLICATE RECORDS FROM  A TABLE(3 ways)
 
13:15
This video tutorial demonstrates about how we can delete duplicate records from a table, the video shows 3 different ways to delete duplicate record from a table, one using Group by, second one by using correlated joins and third on by using rownum analytical function You can get the code from our website http://oracleplsqlblog.com/FullBlog/FullBlog/21
Views: 3572 Kishan Mashru
02 How to configure Rang partition In oracle database
 
15:35
Now a days enterprises run databases of hundred of Gigabytes in size. These databases are known as Very Large Databases (VLDB). From Oracle Ver. 8.0 Oracle has provided the feature of table partitioning i.e. you can partition a table according to some criteria . For example you have a SALES table with the following structure Suppose this table contains millions of records, but all the records belong to four years only i.e. 1991, 1992, 1993 and 1994. And most of the time you are concerned about only one year i.e. you give queries like the following select sum(amt) from sales where year=1991; select product,sum(amt) from sales where year=1992 Group by product; Now whenever you give queries like this Oracle will search the whole table. If you partition this table according to year, then the performance is improve since oracle will scan only a single partition instead of whole table. This type of partitioning is useful when dealing with data that has logical ranges into which it can be distributed; for example, value of year. Performance is best when the data evenly distributes across the range
Views: 1812 OnLinE ReSoUrCe
ROWID VS ROWNUM IN ORACLE
 
09:21
This Video explains the difference between ROWID and ROWNUM using real project examples. ROWID provides the unique physical address where the row is being stored. ROWNUM indicates the order in which the data was returned from the select query.
Views: 2125 Tech Coach
Installing Linux & Windows in Dual Boot: CORRECT PARTITION SCHEME & BOOT LOADER SETUP
 
16:12
In this video, I will cover two important steps of Installing Linux alongside your windows OS. 1) Choosing the correct Partition scheme 2) Setting up your Windows Boot loader to boot to Linux instead of Linux bootloader (e.g : GRUB) During a standard Linux installation, a user do not have to worry about this. But when you are trying to install Linux in separate partition, keeping your current OS, it gets little trickier. If you do not configure these two options correctly, you might end up corrupting your bootloader or previous OS installation. I will also show how you can add your Linux os option to the Windows 8 bootloader using BCDedit. This is important so that in case in future if you decide to get rid of Linux OS, your computer boots normally without any issues.
Views: 78288 XPSTECH
SQL TOP, RANK, DENSE_RANK, ROW_NUMBER Functions
 
08:27
Jamie King of Neumont University demonstrating various SQL ranking functions.
Views: 21747 Jamie King
Merge Statement in Oracle SQL with Example (UPDATE/DELETE or INSERT)
 
15:04
This video demonstrates how to write a Merge Statement in oracle sql, how it is useful in doing a conditional update or delete or both of them when the condition between the target table and source table is evaluated to true, and how we can insert the record into the target table when condition is evaluated to false. The video also shows the use of UPDATE, DELETE and INSERT with Merge, and also the various possible ways to use a Merge statement!!!
Views: 7599 Kishan Mashru
PART 7 MERGE PARTITION
 
01:54
merge partition, alter table, data warehousing
01 Oracle database Table lock
 
20:58
Purpose Use the LOCK TABLE statement to lock one or more tables, table partitions, or table subpartitions in a specified mode. This lock manually overrides automatic locking and permits or denies access to a table or view by other users for the duration of your operation. Some forms of locks can be placed on the same table at the same time. Other locks allow only one lock for a table. A locked table remains locked until you either commit your transaction or roll it back, either entirely or to a savepoint before you locked the table. A lock never prevents other users from querying the table. A query never places a lock on a table. Readers never block writers and writers never block readers. See Also: Oracle Database Concepts for a complete description of the interaction of lock modes COMMIT ROLLBACK SAVEPOINT Prerequisites The table or view must be in your own schema or you must have the LOCK ANY TABLE system privilege, or you must have any object privilege on the table or view. ROW SHARE ROW SHARE permits concurrent access to the locked table but prohibits users from locking the entire table for exclusive access. ROW SHARE is synonymous with SHARE UPDATE, which is included for compatibility with earlier versions of Oracle Database. ROW EXCLUSIVE ROW EXCLUSIVE is the same as ROW SHARE, but it also prohibits locking in SHARE mode. ROW EXCLUSIVE locks are automatically obtained when updating, inserting, or deleting. SHARE UPDATE See ROW SHARE. SHARE SHARE permits concurrent queries but prohibits updates to the locked table. SHARE ROW EXCLUSIVE SHARE ROW EXCLUSIVE is used to look at a whole table and to allow others to look at rows in the table but to prohibit others from locking the table in SHARE mode or from updating rows. EXCLUSIVE EXCLUSIVE permits queries on the locked table but prohibits any other activity on it. NOWAIT Specify NOWAIT if you want the database to return control to you immediately if the specified table, partition, or table subpartition is already locked by another user. In this case, the database returns a message indicating that the table, partition, or subpartition is already locked by another user. WAIT Use the WAIT clause to indicate that the LOCK TABLE statement should wait up to the specified number of seconds to acquire a DML lock. There is no limit on the value of integer. If you specify neither NOWAIT nor WAIT, then the database waits indefinitely until the table is available, locks it, and returns control to you. When the database is executing DDL statements concurrently with DML statements, a timeout or deadlock can sometimes result. The database detects such timeouts and deadlocks and returns an error.
Views: 644 OnLinE ReSoUrCe
How to add Hard Disks in Oracle VirtualBox
 
02:53
We will learn how to add hard disks into an existing virtual machines. This is identical to adding hard disks to a physical machine and can be used for a variety of reasons: more data storage, better performance or increased reliability via RAID setup and others. Dynamic Storage Terms: http://www.avoiderrors.net/?p=4034
Views: 36890 AvoidErrors
FIRST VALUE function in SQL Server
 
02:48
In this video we will discuss FIRST_VALUE function in SQL Server FIRST_VALUE function Introduced in SQL Server 2012 Retrieves the first value from the specified column ORDER BY clause is required PARTITION BY clause is optional Syntax : FIRST_VALUE(Column_Name) OVER (ORDER BY Col1, Col2, ...) FIRST_VALUE function example WITHOUT partitions : In the following example, FIRST_VALUE function returns the name of the lowest paid employee from the entire table. SELECT Name, Gender, Salary, FIRST_VALUE(Name) OVER (ORDER BY Salary) AS FirstValue FROM Employees FIRST_VALUE function example WITH partitions : In the following example, FIRST_VALUE function returns the name of the lowest paid employee from the respective partition. SELECT Name, Gender, Salary, FIRST_VALUE(Name) OVER (PARTITION BY Gender ORDER BY Salary) AS FirstValue FROM Employees Text version of the video http://csharp-video-tutorials.blogspot.com/2015/10/firstvalue-function-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/10/firstvalue-function-in-sql-server_6.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 31624 kudvenkat
SQL: Understanding the JOIN clause in the SELECT statement
 
09:17
This screencast introduces table joins, including differences between SQL 89 and SQL 92 join syntax. The various join types such as natural (inner) joins and left/right/full outer joins, and cross joins.
Views: 140766 Michael Fudge
TablePartitioning.mp4
 
15:55
Partition Tables Sql Server 2008
Views: 3092 Muhammad Shalaby
HAVING clause and difference with GROUP BY & WHERE clause in SQL statement
 
10:17
Using HAVING clause and difference with GROUP BY & WHERE clause in SQL statement Link for scripts on my blog: https://sqlwithmanoj.com/2015/05/23/sql-basics-difference-between-where-group-by-and-having-clause/ Check the whole "SQL Server Basics" series here: https://www.youtube.com/playlist?list=PLU9JMEzjCv14f3cWDhubPaddxRvx1reKR Check my SQL blog at: http://sqlwithmanoj.com/ Check my SQL FB Page at: https://www.facebook.com/sqlwithmanoj
Views: 57330 SQL with Manoj
Oracle Rowid, RowNum and row_number
 
06:44
Oracle Rowid, RowNum and row_number... Explained in detailed...
Views: 5443 CONNECT TO LEARN
SQL 2012 Developer tutorial: Querying Partitions
 
13:56
SQL 2012 Developer tutorial: Querying Partitions with Expert Instructor -- Frank Tillinghast. Get full course details @ http://bit.ly/12bB9bP In this course we'll explore partitioning, and specifically how it's implemented using SQL Server 2012. Partitioning is a way to manage large amounts of data, and while certainly not a new concept, SQL Server has made improvements over the years that make your job as a database architect and developer easier. We'll start off by discussing the evolution of partitioning in SQL Server. You'll learn about partition keys, schemas and functions and how they affect tables, indexes, and the organization of your data. Once you have an understanding of the basics, we'll move on to discuss methods for querying partitions. As time goes on, it may be necessary to make adjustments to your partitions. Next you'll learn how to merge or split partitions, switch out partitions, and make modifications to partition schemes. The course then concludes with some tips on how performance tuning.
Views: 3925 LearnNowOnline
Oracle LISTAGG Function
 
04:57
https://www.databasestar.com/oracle-listagg/ The Oracle LISTAGG function allows you to aggregate or combine string values from multiple rows into a single row. For example, it turns this data: FIRST_NAME Adam Brad Carrie Into this data: FIRST_NAME Adam, Brad, Carrie The same data is shown, but it’s in one row and not multiple. It’s a valuable string manipulation function, and once you know what it is and how it works, you’ll be able to use it in your queries as needed. So what does it look like? The function is: LISTAGG ( measure_expr [, delimiter]) WITHIN GROUP (order_by_clause) [OVER query_partition_clause] These parameters are: measure_expr: This is a column or expression that you want to concatenate the values of. In the example above, it was the first_name column. Mandatory. delimiter: This is the character between each of the measure_expr values. Optional, the default is a comma. order_by_clause: This is the order that the values from the measure_expr are listed. Mandatory. query_partition_clause: This allows you to use LISTAGG as an analytic function, allowing you to show LISTAGG in groups for different rows. One thing to be aware of is that the output of the Oracle LISTAGG function is limited to 4,000 bytes. If you get more than this, you’ll receive an error. The most common way around this that I’ve seen is to write a custom function and use a CLOB. Watch the video to find out more and see some examples. For more information about the Oracle LISTAGG function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-listagg/
Views: 2225 Database Star
Random number &  Random String in Oracle/ عربي
 
06:44
oracle sql Random number & Random String in Oracle select dbms_random.random from dual; select dbms_random.value from dual; select dbms_random.value(1,10) from dual; select round(dbms_random.value(1,10) ) from dual; /* 'u', 'U' - returning string in uppercase alpha characters 'l', 'L' - returning string in lowercase alpha characters 'a', 'A' - returning string in mixed case alpha characters 'x', 'X' - returning string in uppercase alpha-numeric characters 'p', 'P' - returning string in any printable characters. */ select dbms_random.STRING('L',15) from dual; select dbms_random.STRING('U',10) from dual; select dbms_random.STRING('A',10) from dual; select dbms_random.STRING('X',20) from dual; select dbms_random.STRING('P',20) from dual;
Views: 695 khaled alkhudari
Difference between rows and range
 
05:52
range vs rows in sql server difference between rows clause and range clause in sql server range clause vs rows clause in sql server sql server running total query running total example in sql server In this video we will discuss the difference between rows and range in SQL Server. This is continuation to Part 116. Please watch Part 116 from SQL Server tutorial before proceeding. Let us understand the difference with an example. We will use the following Employees table in this demo. SQL Script to create the Employees table Create Table Employees ( Id int primary key, Name nvarchar(50), Salary int ) Go Insert Into Employees Values (1, 'Mark', 1000) Insert Into Employees Values (2, 'John', 2000) Insert Into Employees Values (3, 'Pam', 3000) Insert Into Employees Values (4, 'Sara', 4000) Insert Into Employees Values (5, 'Todd', 5000) Go Calculate the running total of Salary and display it against every employee row The following query calculates the running total. We have not specified an explicit value for ROWS or RANGE clause. SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary) AS RunningTotal FROM Employees So the above query is using the default value which is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW This means the above query can be re-written using an explicit value for ROWS or RANGE clause as shown below. SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotal FROM Employees We can also achieve the same result, by replacing RANGE with ROWS SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotal FROM Employees What is the difference between ROWS and RANGE To understand the difference we need some duplicate values for the Salary column in the Employees table. Execute the following UPDATE script to introduce duplicate values in the Salary column Update Employees set Salary = 1000 where Id = 2 Update Employees set Salary = 3000 where Id = 4 Go Now execute the following query. Notice that we get the running total as expected. SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotal FROM Employees The following query uses RANGE instead of ROWS SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS RunningTotal FROM Employees Notice we don't get the running total as expected. So, the main difference between ROWS and RANGE is in the way duplicate rows are treated. ROWS treat duplicates as distinct values, where as RANGE treats them as a single entity. All together side by side. The following query shows how running total changes 1. When no value is specified for ROWS or RANGE clause 2. When RANGE clause is used explicitly with it's default value 3. When ROWS clause is used instead of RANGE clause SELECT Name, Salary, SUM(Salary) OVER(ORDER BY Salary) AS [Default], SUM(Salary) OVER(ORDER BY Salary RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS [Range], SUM(Salary) OVER(ORDER BY Salary ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS [Rows] FROM Employees Text version of the video http://csharp-video-tutorials.blogspot.com/2015/10/difference-between-rows-and-range.html Slides http://csharp-video-tutorials.blogspot.com/2015/10/difference-between-rows-and-range_8.html All SQL Server Text Articles http://csharp-video-tutorials.blogspot.com/p/free-sql-server-video-tutorials-for.html All SQL Server Slides http://csharp-video-tutorials.blogspot.com/p/sql-server.html All Dot Net and SQL Server Tutorials in English https://www.youtube.com/user/kudvenkat/playlists?view=1&sort=dd All Dot Net and SQL Server Tutorials in Arabic https://www.youtube.com/c/KudvenkatArabic/playlists
Views: 32169 kudvenkat
Oracle sql Interview Question : How to change rows to column
 
09:18
This video tutorial talks about the frequently asked oracle sql interview question of changing rows to the column. Based on the given scenario, we are asked to change the presentation of data in a table with 3 rows and 2 column to 3 columns and 2 rows. Decode Function in oracle https://youtu.be/YUAjPMjqMws Pivot and unpivot in oracle https://youtu.be/6s0DI1YcWIM
Views: 12436 Kishan Mashru
02 Shared Lock & Exclusive Lock In oracle database table lock
 
11:32
Purpose Use the LOCK TABLE statement to lock one or more tables, table partitions, or table subpartitions in a specified mode. This lock manually overrides automatic locking and permits or denies access to a table or view by other users for the duration of your operation. Some forms of locks can be placed on the same table at the same time. Other locks allow only one lock for a table. A locked table remains locked until you either commit your transaction or roll it back, either entirely or to a savepoint before you locked the table. A lock never prevents other users from querying the table. A query never places a lock on a table. Readers never block writers and writers never block readers. See Also: Oracle Database Concepts for a complete description of the interaction of lock modes COMMIT ROLLBACK SAVEPOINT Prerequisites The table or view must be in your own schema or you must have the LOCK ANY TABLE system privilege, or you must have any object privilege on the table or view. ROW SHARE ROW SHARE permits concurrent access to the locked table but prohibits users from locking the entire table for exclusive access. ROW SHARE is synonymous with SHARE UPDATE, which is included for compatibility with earlier versions of Oracle Database. ROW EXCLUSIVE ROW EXCLUSIVE is the same as ROW SHARE, but it also prohibits locking in SHARE mode. ROW EXCLUSIVE locks are automatically obtained when updating, inserting, or deleting. SHARE UPDATE See ROW SHARE. SHARE SHARE permits concurrent queries but prohibits updates to the locked table. SHARE ROW EXCLUSIVE SHARE ROW EXCLUSIVE is used to look at a whole table and to allow others to look at rows in the table but to prohibit others from locking the table in SHARE mode or from updating rows. EXCLUSIVE EXCLUSIVE permits queries on the locked table but prohibits any other activity on it. NOWAIT Specify NOWAIT if you want the database to return control to you immediately if the specified table, partition, or table subpartition is already locked by another user. In this case, the database returns a message indicating that the table, partition, or subpartition is already locked by another user. WAIT Use the WAIT clause to indicate that the LOCK TABLE statement should wait up to the specified number of seconds to acquire a DML lock. There is no limit on the value of integer. If you specify neither NOWAIT nor WAIT, then the database waits indefinitely until the table is available, locks it, and returns control to you. When the database is executing DDL statements concurrently with DML statements, a timeout or deadlock can sometimes result. The database detects such timeouts and deadlocks and returns an error.
Views: 745 OnLinE ReSoUrCe
Does partitioning Improve performance ? Explained
 
07:14
Partitioning is a great feature for improving the way we manage our data. However we can also improve performance of select statements from the table as well. This requires a good understanding of the way partitioning works and how properly placing files on the disk can improve the IO performance. One common way that partitioning can improve performance for loading data is the sliding window method but in this post I am mainly talking about how to improve read performance. Before showing the improvements from partitioning it’s important to visit the indexes since a common belief is that a good index can provide faster data access than partitioning can.
Views: 997 Jayanth Kurup

Sales assistant cover letter template
Annotated bibliography mla example 2014 jeep
Merchandising assistant cover letter examples
Fully executed contract cover letter
Internships cover letter samples