
sql - What is SELF JOIN and when would you use it? - Stack Overflow
Jun 13, 2024 · You use a self join when a table references data in itself. E.g., an Employee table may have a SupervisorID column that points to the employee that is the boss of the current employee. To …
sql - NOT IN vs NOT EXISTS - Stack Overflow
Which of these queries is the faster? NOT EXISTS: SELECT ProductID, ProductName FROM Northwind..Products p WHERE NOT EXISTS ( SELECT 1 FROM Northwind..[Order Details] od …
CASE .. WHEN expression in Oracle SQL - Stack Overflow
CASE .. WHEN expression in Oracle SQL Asked 13 years, 2 months ago Modified 4 years, 10 months ago Viewed 969k times
How do I perform an IF...THEN in an SQL SELECT?
Sep 15, 2008 · 116 You can find some nice examples in The Power of SQL CASE Statements, and I think the statement that you can use will be something like this (from 4guysfromrolla):
Convert Rows to columns using 'Pivot' in SQL Server
Apr 10, 2013 · If you are using SQL Server 2005+, then you can use the PIVOT function to transform the data from rows into columns. It sounds like you will need to use dynamic sql if the weeks are …
SQL WITH clause example - Stack Overflow
Sep 23, 2012 · 353 The SQL WITH clause was introduced by Oracle in the Oracle 9i release 2 database. The SQL WITH clause allows you to give a sub-query block a name (a process also called …
sql - Case in Select Statement - Stack Overflow
Jan 7, 2013 · The following examples uses the CASE expression in an ORDER BY clause to determine the sort order of the rows based on a given column value. In the first example, the value in the …
Nested select statement in SQL Server - Stack Overflow
Check for more subquery rules and subquery types. More examples of Nested Subqueries. IN / NOT IN – This operator takes the output of the inner query after the inner query gets executed which can be …
Understanding PIVOT function in T-SQL - Stack Overflow
Understanding PIVOT function in T-SQL Asked 13 years, 7 months ago Modified 2 years, 3 months ago Viewed 255k times
sql - Oracle "Partition By" Keyword - Stack Overflow
Oct 28, 2016 · Can someone please explain what the partition by keyword does and give a simple example of it in action, as well as why one would want to use it? I have a SQL query written by …