This video demonstrates examples on how to find and delete duplicate records from a table. The video gives simple and easy to understand examples on finding duplicate records from a table using group by and having clause and row_number function. It also shows the ways in which duplicates can be deleted very efficiently using the rowid of that record. You can get the code from our website http://oracleplsqlblog.com/FullBlog/FullBlog/21
Views: 11906 Kishan Mashru
From SQL Queries Joes 2 Pros (Vol2) ch4.1. Learn up to write aggregated queries.
Views: 186849 Joes2Pros SQL Trainings
------------------Online Courses to learn---------------------------- Java - https://bit.ly/2H6wqXk C++ - https://bit.ly/2q8VWl1 AngularJS - https://bit.ly/2qebsLu Python - https://bit.ly/2Eq0VSt C- https://bit.ly/2HfZ6L8 Android - https://bit.ly/2qaRSAS Linux - https://bit.ly/2IwOuqz AWS Certified Solutions Architect - https://bit.ly/2JrGoAF Modern React with Redux - https://bit.ly/2H6wDtA MySQL - https://bit.ly/2qcF63Z ----------------------Follow--------------------------------------------- My Website - http://www.codebind.com My Blog - https://goo.gl/Nd2pFn My Facebook Page - https://goo.gl/eLp2cQ Google+ - https://goo.gl/lvC5FX Twitter - https://twitter.com/ProgrammingKnow Pinterest - https://goo.gl/kCInUp Text Case Converter - https://goo.gl/pVpcwL -------------------------Stuff I use to make videos ------------------- Stuff I use to make videos Windows notebook – http://amzn.to/2zcXPyF Apple MacBook Pro – http://amzn.to/2BTJBZ7 Ubuntu notebook - https://amzn.to/2GE4giY Desktop - http://amzn.to/2zct252 Microphone – http://amzn.to/2zcYbW1 notebook mouse – http://amzn.to/2BVs4Q3 ------------------Facebook Links ---------------------------------------- http://fb.me/ProgrammingKnowledgeLearning/ http://fb.me/AndroidTutorialsForBeginners http://fb.me/Programmingknowledge http://fb.me/CppProgrammingLanguage http://fb.me/JavaTutorialsAndCode http://fb.me/SQLiteTutorial http://fb.me/UbuntuLinuxTutorials http://fb.me/EasyOnlineConverter sql query - how to count values in a row sql Get row count of a resultset in java SQL COUNT Function java Java get number of rows in resultset Counting Rows with COUNT() java
Views: 22718 ProgrammingKnowledge
►For Registration : https://goo.gl/r6kJbB ►Call: +91-8179191999 ► Visit Our Website: http://nareshit.in/ http://nareshit.com/ ► About NareshIT: "Naresh IT is the Best Software Training Institute for Hadoop, Salesforce, AWS, DevOps, Sprak, Data Science, Python, Tableau, RPA ,Java, C#.NET, ASP.NET, Oracle, Testing Tools, Silver light, Linq, SQL Server, Selenium, Android, iPhone, C Language, C++, PHP and Digital Marketing in Hyderabad, Chennai and Vijayawada, India which provides online and classroom training classes" ►For Registration : https://goo.gl/r6kJbB ►Call: India- 8179191999, USA- 404-232-9879 Email: [email protected] ►Our Online Training Features: 1.Training with Real-Time Experts 2.Industry Specific Scenario’s 3.Flexible Timings 4.Soft Copy of Material 5.Share Video's of each and every session. Check The Below Links: ►For Course Reg : https://goo.gl/r6kJbB ► Subscribe to Our Channel: https://goo.gl/q9ozyG ► Circle us on G+: https://plus.google.com/NareshIT ► Like us on Facebook: https://www.facebook.com/NareshIT ► Follow us on Twitter: https://twitter.com/nareshitech ► Visit Our Website: http://nareshit.in/ http://nareshit.com/
Views: 12391 Naresh i Technologies
APEX 18.1 video 27 of 30: Do some housekeeping: Assign new pages to page groups. See some more features in the interactive grid and interactive report pages for organizing and summarizing data. Reorder columns. Use the “control break” and “count” features. See an issue using COUNT when a field might have null values (no data).
Views: 476 Jennifer Kreie
This video demonstrated how to change the logic of a given row calculation based on the value in another column. You may run in to a scenerion where you need to implement this when you have a requirement that the rows with one dimension value have logic "X" (for instance Mean) and the the rows with a different dimension value have logic "Y" (for instance a Median) assigned. This is accomplished with the Switch (Case) expression in the OBIEE formula builder.
Views: 9237 Justin W. Steigerwalt
Explains what a multi row subquery is and what it can be used for. This is a subquery that returns multiple rows, and it needs to be treated differently. The full Introduction to Oracle SQL course is available here: https://www.databasestar.com/introduction-to-oracle-sql-course/
Views: 1405 Database Star
In this video you will learn how to get the insert row count and log into audit table for SSIS Package. This is real time scenario that we use to log different type of row counts such as insert, update, delete to log table for each SSIS Package execution. The video also covers How to create an SSIS Package How to use Data Flow Task in SSIS Package How to create Audit Table for SSIS Package Execution How to use Flat file Source to read text file in SSIS Package How to load data to a table in SSIS Package How to create variables in SSIS Package How to store Insert row count in a variable in SSIS Package How to use Execute SQL Task in SSIS Package How to Map parameters for Insert statement in Execute SQL Task in SSIS Package How to use Data Flow Task with Source and Destination in SSIS Package Check out our Full Step by Step SQL Server Integration Services(SSIS) Tutorial http://www.techbrothersit.com/2014/12/ssis-videos.html
Views: 23127 TechBrothersIT
How To Find Duplicate Or Multiple Rows Count From Table | ORACLE 11g | 3i Tutorials For All Tutorials | How to | Step by Step sql, query, sql developer, group by, having, count #3itutorialsforall #oracle11g #sql #query Like us on facebook: https://www.facebook.com/3iTemplateItSolutions
Views: 3 3i Tutorials For All
This video explains analytical functions and how they are implemented in real projects. Analytical functions are somewhat similar to aggregate functions,but they offer much more. Why use analytical function ? They allow you to write fast and concise queries which otherwise will involve self join and long processing times They allow you to perform aggregate functions independently on sets of partitions. You can access values from previous rows in current row and you can restrict the window on which you want to apply this analytical function. I have given additional practice exercises along with the dataset so that you can comfortably work with analytical functions. You can find the sample problems along with dataset in the below link. http://www.internshipsfromhome.com/oracle-analytical-functions-ddl-and-dml/
Views: 27421 Tech Coach
In this lecture you will learn about PIVOT operator and using it to generate dynamic columns.PIVOT is very use full operator to convert values into columns. PIVOT: •Convert your output from (values)vertical order to horizontal(making columns) one Topic to cover: •PIVOT example •PIVOT syntax •Interview Question •PIVOT on northwind •Dynamic PIVOT query http://www.techsapphire.in/index/pivot_sql_lesson_with_generating_dynamic_columns_with_pivot/0-158
Views: 32229 techsapphire
https://www.databasestar.com/oracle-dense_rank/ The Oracle DENSE_RANK function allows you to calculate a rank of a row in a group of rows. It returns this rank as a NUMBER value. This function can be used as either an analytic or an aggregate function, and the syntax depends on how you use it. As an aggregate function it looks like this: DENSE_RANK ( expr, [expr(n)] ) WITHIN GROUP ( ORDER BY (order_expr [ASC|DESC] [NULLS FIRST|LAST] ) These parameters are: - expr: this is the value to search for in a particular table. You can specify multiple search values, and just separate them by a comma. - order_expr: this is used to order the expr values by, because you get a different results depending on what order you rank the values in. - NULLS FIRST or LAST: this is where you can specify if you want to have NULL values appear at the top of your ranking order or at the bottom. As an analytic function, it looks like this: DENSE_RANK() OVER ( [query_partition_clause] order_by_clause) The parameters are: - query_partition_clause: this is the expression that the ranking is “grouped” by, as analytic functions allow you to group data within rows. - order_by_clause: this is the expression to order your results by to determine a rank. For this function, if two records have the same sort or rank position, they will have the same RANK value. It won’t cause a gap in the rankings, unlike the RANK function which does cause a gap. For more information about the Oracle DENSE_RANK function, including all of the SQL shown in this video and the examples, read the related article here: https://www.databasestar.com/oracle-dense_rank/
Views: 525 Database Star
sql server row_number example sql server row number by partition sql server row_number over partition by order by In this video we will discuss Row_Number function in SQL Server. This is continuation to Part 108. Please watch Part 108 from SQL Server tutorial before proceeding. Row_Number function Introduced in SQL Server 2005 Returns the sequential number of a row starting at 1 ORDER BY clause is required PARTITION BY clause is optional When the data is partitioned, row number is reset to 1 when the partition changes Syntax : ROW_NUMBER() OVER (ORDER BY Col1, Col2) Row_Number function without PARTITION BY : In this example, data is not partitioned, so ROW_NUMBER will provide a consecutive numbering for all the rows in the table based on the order of rows imposed by the ORDER BY clause. SELECT Name, Gender, Salary, ROW_NUMBER() OVER (ORDER BY Gender) AS RowNumber FROM Employees Please note : If ORDER BY clause is not specified you will get the following error The function 'ROW_NUMBER' must have an OVER clause with ORDER BY Row_Number function with PARTITION BY : In this example, data is partitioned by Gender, so ROW_NUMBER will provide a consecutive numbering only for the rows with in a parttion. When the partition changes the row number is reset to 1. SELECT Name, Gender, Salary, ROW_NUMBER() OVER (PARTITION BY Gender ORDER BY Gender) AS RowNumber FROM Employees Use case for Row_Number function : Deleting all duplicate rows except one from a sql server table. Discussed in detail in Part 4 of SQL Server Interview Questions and Answers video series. Text version of the video http://csharp-video-tutorials.blogspot.com/2015/09/rownumber-function-in-sql-server.html Slides http://csharp-video-tutorials.blogspot.com/2015/09/rownumber-function-in-sql-server_30.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: 90385 kudvenkat
Learn about the Count function in the SQL Language. Visit http://www.SqlTrainingOnline.com for 30 more FREE videos. The Microsoft SQL Server 2012 SQL Count Function is used to give you a total number of records in your resultset or within a group of data. You would group the data using a group by clause in the SQL Statement. You can visit me at any of the following: SQL Training Online: http://www.sqltrainingonline.com Twitter: http://www.twitter.com/sql_by_joey Google+: https://plus.google.com/#100925239624117719658/posts LinkedIn: http://www.linkedin.com/in/joeyblue Facebook: http://www.facebook.com/sqltrainingonline
Views: 24912 Joey Blue
This video explains you that how you can count the number of rows affected after DML write operations. Oracle is being used as the database.
Views: 61 Eduphilics
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/05/part-4-delete-duplicate-rows-in-sql.html In this video, we will discuss deleting all duplicate rows except one from a sql server table. SQL Script to create Employees table Create table Employees ( ID int, FirstName nvarchar(50), LastName nvarchar(50), Gender nvarchar(50), Salary int ) GO Insert into Employees values (1, 'Mark', 'Hastings', 'Male', 60000) Insert into Employees values (1, 'Mark', 'Hastings', 'Male', 60000) Insert into Employees values (1, 'Mark', 'Hastings', 'Male', 60000) Insert into Employees values (2, 'Mary', 'Lambeth', 'Female', 30000) Insert into Employees values (2, 'Mary', 'Lambeth', 'Female', 30000) Insert into Employees values (3, 'Ben', 'Hoskins', 'Male', 70000) Insert into Employees values (3, 'Ben', 'Hoskins', 'Male', 70000) Insert into Employees values (3, 'Ben', 'Hoskins', 'Male', 70000) The delete query should delete all duplicate rows except one. Here is the SQL query that does the job. PARTITION BY divides the query result set into partitions. WITH EmployeesCTE AS ( SELECT *, ROW_NUMBER()OVER(PARTITION BY ID ORDER BY ID) AS RowNumber FROM Employees ) DELETE FROM EmployeesCTE WHERE RowNumber ] 1
Views: 366152 kudvenkat
Other ways to use the COUNT function in SQL. The full Introduction to Oracle SQL course is available here: https://www.databasestar.com/introduction-to-oracle-sql-course/
Views: 305 Database Star
Find duplicate row values in a field or multiple fields in SQL Server table with this tutorial. Do this for one column, or multiple columns. Uses SQL Server Management Studio for the demonstration.
Views: 48264 Edward Kench
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: 36964 kudvenkat
This video tutorial answers the frequently asked interview question, how to select only odd or even records in oracle sql, after watching this video you will understand more on the topic and will be able to answer this interview question with a lot of confidence.
Views: 4945 Kishan Mashru
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: 19337 Kishan Mashru
There are various times when we need to find duplicate records in SQL Server. It is possible to find duplicates using DISTINCT, ROW NUMBER as well as the GROUP BY approach. ------------- May be you like this -------------- umbraco playlist : https://www.youtube.com/watch?v=zoefdruzmGE&list=PLv0T7WlllnSnYRedhwL8x-atkVxrSdd3m Angularjs playlist : https://www.youtube.com/watch?v=KXjD1RiAz1U&list=PLv0T7WlllnSkCfNftTNY8tWqCFWT0sIMd jquery playlist : https://www.youtube.com/watch?v=jVncasz_iyw&list=PLv0T7WlllnSkkNahiiWu_GMXq49X5ccfe F Wcf playlist : https://www.youtube.com/watch?v=NB4k0RC6vl0&list=PLv0T7WlllnSmcGHacEQnLgKvitcJEsSl6 c# playlist: https://www.youtube.com/watch?v=ZrP0NKbsr8s&list=PLv0T7WlllnSl9pZWMaMGsyoAmqZtW4gM0 Duplicate records can create problems sometimes when displaying reports or performing a Multiple Insert update. Finding duplicate records in a database needs further investigation. In some cases, duplicate records are positive, but it all depends on the data and the database design as well. For example, if a customer has ordered the same product twice on the same date with the the same shipping and billing address, then this may result in a duplicate record.
Views: 16661 Go Freelancer
This video shows you advanced properties of pivot table in obiee 11g and obiee 12c
Views: 5986 Tutorials for beginners
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/06/part-6-transform-rows-into-columns-in.html This is another common sql server interview question. We will be using Countries table in this example. SQL to create the table Create Table Countries ( Country nvarchar(50), City nvarchar(50) ) GO Insert into Countries values ('USA','New York') Insert into Countries values ('USA','Houston') Insert into Countries values ('USA','Dallas') Insert into Countries values ('India','Hyderabad') Insert into Countries values ('India','Bangalore') Insert into Countries values ('India','New Delhi') Insert into Countries values ('UK','London') Insert into Countries values ('UK','Birmingham') Insert into Countries values ('UK','Manchester') Here is the interview question. Write a sql query to transpose rows to columns. Using PIVOT operator we can very easily transform rows to columns. Select Country, City1, City2, City3 From ( Select Country, City, 'City'+ cast(row_number() over(partition by Country order by Country) as varchar(10)) ColumnSequence from Countries ) Temp pivot ( max(City) for ColumnSequence in (City1, City2, City3) ) Piv
Views: 208791 kudvenkat
This video shows the simplest, most commonly used SQL command: SELECT ... FROM. We use SQL Developer to view data from tables in the students-teams database and in the HR database. We see how to specify a schema name for a table and how to count rows in a table without showing detailed data from the table. (5 of 15) There is also an "Advanced SQL" series. (Search for "databasemec" for tutorials using SQL Server.)
Views: 3601 Jennifer Kreie
Oracle SQL Developer Tutorial For Beginners Series. This course introduces Oracle SQL Development for its subscribers. Currently this is based on Oracle 12c. The test environment is in Windows 10.
Views: 729 Sam Dhanasekaran
http://bit.ly/oracle-sql-course | Get the complete course today. Learn Oracle SQL : Filtering Duplicate Rows ( The DISTINCT Clause ): In this video, I show you how you can use the DISTINCT clause to remove duplicate rows from the results of your queries. This is an excerpt of the course " Oracle SQL From Scratch " which you can get at a discounted price here: http://bit.ly/oracle-sql-course You can find additional Oracle SQL related articles and educational content in my blog here: http://standout-dev.com/
Views: 260 Oracle SQL
Oracle retrieve data from xml document using xmltable
Views: 7018 Sridhar Raghavan
How to count the Number of rows in a table. How to display the column from multiple table. Use of Group By Clause. MySql Tutorial #7: Counting Rows and Select data from multiple table. Thanks for watching my videos regularly and motivate me to touch the another milestone. Please subscribe my channel "Learn TechToTech" My Website : www.learnfromrakesh.com My Twitter Account : https://twitter.com/LearnTechtotech My Facebook Account: https://www.facebook.com/LearnTechToTech
Views: 530 Learn TechToTech
Explains Column Function COUNT or How to count the number of column rows. From http://ComputerBasedTrainingInc.com SQL Course. Learn by doing SQL commands for ANSI Standard SQL, Access, DB2, MySQL, Oracle, PostgreSQL, and SQL Server.
Views: 1153 cbtinc
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/06/part-8-sql-query-to-find-department.html Scenario asked in the SQL Server Interview Based on the above two tables write a SQL Query to get the name of the Department that has got the maximum number of Employees. To answer this question it will be helpful if you the knowledge of JOINS & GROUP BY in SQL Server. We discusses these in Parts 11 & 12 of SQL Server Tutorial video series. SQL query that retrieves the department name with maximum number of employees SELECT TOP 1 DepartmentName FROM Employees JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID GROUP BY DepartmentName ORDER BY COUNT(*) DESC Scenario asked in the SQL Server Interview Based on the above two tables write a SQL Query to get the name of the Department that has got the maximum number of Employees. To answer this question it will be helpful if you the knowledge of JOINS & GROUP BY in SQL Server. We discusses these in Parts 11 & 12 of SQL Server Tutorial video series. SQL query that retrieves the department name with maximum number of employees SELECT TOP 1 DepartmentName FROM Employees JOIN Departments ON Employees.DepartmentID = Departments.DepartmentID GROUP BY DepartmentName ORDER BY COUNT(*) DESC
Views: 131874 kudvenkat
Explaining How to get Count and Sum Value in Oracle Database in others words what is the aggregate function in Oracle or what are the types of aggregate function in SQL An Aggregate function is a function where the values of multiple rows are grouped together to form a single value of more significant meaning or measurements such as a set, a bag or a list or Aggregate Function in Oracle SQL Database or Aggregate Function in SQL or How to use Count and sum Aggregate Function in Oracle or Types of Aggregate function in SQL Assignment: Assignment link will be available soon: SQL basics, create table oracle, SQL functions, SQL queries, SQL server, SQL developer installation, Oracle database installation, SQL Statement, OCA, Data Types, Types of data types, SQL Logical Operator, SQL Function,Join- Inner Join, Outer join, right outer join, left outer join, full outer join, self-join, cross join, View, SubQuery, Set Operator. Follow me on: Facebook Page: https://www.facebook.com/LrnWthr-319371861902642/?ref=bookmarks Contacts Email: [email protected] Instagram: https://www.instagram.com/equalconnect/ Twitter: https://twitter.com/LrnWthR
Views: 59 EqualConnect Coach
Link for all dot net and sql server video tutorial playlists http://www.youtube.com/user/kudvenkat/playlists Link for slides, code samples and text version of the video http://csharp-video-tutorials.blogspot.com/2014/05/part-2-sql-query-to-get-organization.html To get the best out of this video, the following concepts need to be understood first. These are already discussed in SQL Server Tutorial. 1. Self-Join - http://www.youtube.com/watch?v=qnYSN_7qwgg 2. CTE - http://www.youtube.com/watch?v=ZXB5b-7HJHk 3. Recursive CTE - http://www.youtube.com/watch?v=GGoV0wTMCg0 Here is the problem definition: 1. Employees table contains the following columns a) EmployeeId, b) EmployeeName c) ManagerId 2. If an EmployeeId is passed, the query should list down the entire organization hierarchy i.e who is the manager of the EmployeeId passed and who is managers manager and so on till full hierarchy is listed. For example, Scenario 1: If we pass David's EmployeeId to the query, then it should display the organization hierarchy starting from David. Scenario 2: If we pass Lara's EmployeeId to the query, then it should display the organization hierarchy starting from Lara. We will be Employees table for this demo. SQL to create and populate Employees table with test data Create table Employees ( EmployeeID int primary key identity, EmployeeName nvarchar(50), ManagerID int foreign key references Employees(EmployeeID) ) GO Insert into Employees values ('John', NULL) Insert into Employees values ('Mark', NULL) Insert into Employees values ('Steve', NULL) Insert into Employees values ('Tom', NULL) Insert into Employees values ('Lara', NULL) Insert into Employees values ('Simon', NULL) Insert into Employees values ('David', NULL) Insert into Employees values ('Ben', NULL) Insert into Employees values ('Stacy', NULL) Insert into Employees values ('Sam', NULL) GO Update Employees Set ManagerID = 8 Where EmployeeName IN ('Mark', 'Steve', 'Lara') Update Employees Set ManagerID = 2 Where EmployeeName IN ('Stacy', 'Simon') Update Employees Set ManagerID = 3 Where EmployeeName IN ('Tom') Update Employees Set ManagerID = 5 Where EmployeeName IN ('John', 'Sam') Update Employees Set ManagerID = 4 Where EmployeeName IN ('David') GO Here is the SQL that does the job Declare @ID int ; Set @ID = 7; WITH EmployeeCTE AS ( Select EmployeeId, EmployeeName, ManagerID From Employees Where EmployeeId = @ID UNION ALL Select Employees.EmployeeId , Employees.EmployeeName, Employees.ManagerID From Employees JOIN EmployeeCTE ON Employees.EmployeeId = EmployeeCTE.ManagerID ) Select E1.EmployeeName, ISNULL(E2.EmployeeName, 'No Boss') as ManagerName From EmployeeCTE E1 LEFT Join EmployeeCTE E2 ON E1.ManagerID = E2.EmployeeId
Views: 305434 kudvenkat
Text Article http://csharp-video-tutorials.blogspot.com/2017/01/sql-query-to-select-all-names-that.html Slides http://csharp-video-tutorials.blogspot.com/2017/01/sql-query-to-select-all-names-that_31.html SQL Server Interview Questions and Answers text articles & slides http://csharp-video-tutorials.blogspot.com/2014/05/sql-server-interview-questions-and.html SQL Server Interview Questions and Answers playlist https://www.youtube.com/playlist?list=PL6n9fhu94yhXcztdLO7i6mdyaegC8CJwR 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 In this video we will discuss writing a SQL query to retrieve all student names that start with letter 'M' without using the LIKE operator. If the interviewer has not mentioned not to use LIKE operator, we would have written the query using the LIKE operator as shown below. SELECT * FROM Students WHERE Name LIKE 'M%' We can use any one of the following 3 SQL Server functions, to achieve exactly the same thing. CHARINDEX LEFT SUBSTRING The following 3 queries retrieve all student rows whose Name starts with letter 'M'. Notice none of the queries are using the LIKE operator. SELECT * FROM Students WHERE CHARINDEX('M',Name) = 1 SELECT * FROM Students WHERE LEFT(Name, 1) = 'M' SELECT * FROM Students WHERE SUBSTRING(Name, 1, 1) = 'M'
Views: 68660 kudvenkat
Statement to get even or odd rows from a table using myLittleAdmin database for SQL server
Views: 1164 Haritha Computers & Technology
In this tutorial we'll learn to use the INSERT Query to copy data from one table into another.
Views: 270717 The Bad Tutorials
How to show only even or odd rows in sql For more SQL Server Tutorial Visit: http://subnol.blogspot.com/ #subnol #sqlfighter
Views: 6942 SQL Fighter
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: 81389 Techtud
sql aggregate functions aggregate functions sql sql analytic functions oracle sql analytic functions SQL have following aggregate functions that can be used to write queries. 1)SUM() -: return sum of columns values. 2)AVG() -: return Average of columns values. 3)COUNT() -: return count of rows according to condition in where clause. 4)COUNT(*) -: return count of rows according to condition in where clause. 5)MAX() -: return Maximum value from table. 6)MIN() -: return minimum value from table. Note : A)Aggregate functions used in SELECT and HAVING clauses. B)Aggregate functions cannot be used in a WHERE clause. SELECT SUM(SALARY) FROM EMPLOYEE SELECT AVG(SALARY) FROM EMPLOYEE SELECT COUNT(SALARY) FROM EMPLOYEE SELECT COUNT(*) FROM EMPLOYEE SELECT MAX(SALARY) FROM EMPLOYEE SELECT MIN(SALARY) FROM EMPLOYEE https://techquerypond.com https://techquerypond.wordpress.com https://twitter.com/techquerypond
Views: 487 Tech Query Pond
Description. The Oracle DISTINCT clause is used to remove duplicates from the result set. ... Syntax. The syntax for the DISTINCT clause in Oracle/PLSQL is: SELECT DISTINCT expressions FROM tables [WHERE conditions]; ... Note. ... Example - With Single Expression. ... Example - With Multiple Expressions. distinct on multiple columns in sql oracle distinct count oracle select distinct on one column where distinct sql sql distinct group by how to select unique records in oracle without using distinct select distinct count SQL Tutorial in Oracle - 4 NULL, LIKE, DISTINCT, ORDER BY SQL SELECT statement is used to fetch the data from a database table which returns data in the form of result table. These result ... Oracle Database11g tutorials 8 || SQL DISTINCT with multiple columns |SQL Distinct with Two columns will show how to use SQL DISTINCT keyword with SQL Select ... SQL Tutorial - 27: The DISTINCT Keyword The Bad Tutorials In this tutorial we'll see how we can pull out unique data from tables using the DISTINCT Clause in our Queries. 55. SELECT DISTINCT in SQL (Hindi) • Please Subscribe Channel Like, Share and Comment Visit : DISTINCT Clause in Oracle | Oracle SQL Tutorial Videos | • DISTINCT Clause in Oracle. Oracle Database11g tutorials 7 | |SQL DISTINCT keyword || SQL tutorials This SQL tutorial and Oracle database 11g tutorial for beginners will show how to use SQL DISTINCT keyword with SQL Select ... 06- Oracle SQL-Arabic Course Concatenation Operator-Quote q Operator-DISTINCT-DESCRIBEاوراكل ديفلوبر • أهلا بكم فى درس جديد من سلسلة دروس أوراكل ديفلوبر شرح SQL فى درس اليوم نتحدث عن Concatenation Operator & Quote q Operator & ... SQL with Oracle 10g XE - Using the DISTINCT Function Lecture Snippets In this video I use the DISTINCT function to list the values of a column from a query and remove the duplicate listings. When using ... SQL Distinct and Multiple Columns • Jamie King of Neumont University showing how SQL DISTINCT varies when multiple columns are present in the result set. Learn Oracle | Alias Names, Concatenation, Distinct Keyword Pebbles present, Learn Oracle 10g with Step By Step Video Tutorials. Learn Oracle 10g Tutorial series contains the following ... 8:54 Oracle Database tutorials 1: How to install Oracle Database 11g on windows 7 How To install Oracle Database 11g enterprise edition On windows 64 bit. Full installation in Single video. Enjoy SQL and ... Related
Views: 30 Muo sigma classes
In this video I use the SELECT command to view the data of a table. When viewing the entire table be sure to choose the appropriate number of records to display from the drop-down menu and then enter the command. To view the Books table I used the following: SELECT * FROM BOOKS; This video is part of a series of videos with the purpose of learning the SQL language. For more information visit Lecture Snippets at http://lecturesnippets.com.
Views: 17024 Lecture Snippets
This video is to understand how to create an oracle pl/sql function, the video demonstrates the use of in, out and in out parameter types. The video also explains on how to call a function from a pl/sql block and from a select statement.
Views: 4720 Kishan Mashru