
How to stack data with SQL Server
Mar 20, 2013 · If you are using SQL Server 2008+, then you can use CROSS APPLY with VALUES: select t.uid, t.id1, t.id2, c.variable, c.value from YourTable t cross apply ( values …
Newest 'sql' Questions - Stack Overflow
In SQL, I have a customer table and an orders table and based on what quantity a customer orders I want to give them a percentage discount. For example, three customer below. Cust 1 …
SQL WITH clause example - Stack Overflow
Sep 23, 2012 · 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 …
What is a SQL JOIN, and what are the different types?
What is SQL JOIN? SQL JOIN is a method to retrieve data from two or more database tables. What are the different SQL JOINs ? There are a total of five JOINs. They are : 1. JOIN or …
Stacking multiple tables in SQL server - Stack Overflow
I am essentially trying to do a UNION all on multiple tables and have the result be a new table. I know that I can do this to select and stack all of the rows: SELECT * FROM table1 UNION ALL …
Understanding PIVOT function in T-SQL - Stack Overflow
I am very new to SQL. I have a table like this: ID TeamID UserID ElementID PhaseID Effort 1 1 1 3 5 6.74 2 1 1 3 6 8.25 3 1 1 4 1 2.23 4 1 1 4 5 6.8 5 1 1 4 6 1.5 And I was told to get data like …
exception - Oracle PL/SQL: how to get the stack trace, package …
Sometimes the exception returns something like: "ORA-06502: PL/SQL: numeric or value error: character string buffer too small". It's not so readable since it doesn't report neither the table, …
sql - What is the difference between PARTITION BY and GROUP BY …
The SQL GROUP BY clause can be used in a SELECT statement to collect data across multiple records and group the results by one or more columns. In more simple words GROUP BY …
sql - What is a stored procedure? - Stack Overflow
Dec 31, 2019 · Stored procedures in SQL Server can accept input parameters and return multiple values of output parameters; in SQL Server, stored procedures program statements to perform …
Should I use != or <> for not equal in T-SQL? - Stack Overflow
Apr 6, 2009 · Yes; Microsoft themselves recommend using <> over != specifically for ANSI compliance, e.g. in Microsoft Press training kit for 70-461 exam, "Querying Microsoft SQL …