Tally Tables in T-SQL
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
57,215 reads
The Tally (or Numbers) table is one of the most useful constructs in intermediate-level SQL. Have you ever written a...
2014-03-27
57,215 reads
In today’s blog I will attempt to challenge the popularly held notion that LIKE “%string%” wildcard searches must be slow...
2014-03-26
20,710 reads
In SQL Server 2005, Microsoft introduced the Common Table Expression (CTE). CTEs share similarities with VIEWS and derived tables, but...
2014-03-23
1,632 reads
If you learn one new T-SQL (i.e., Microsoft SQL Server) concept today it should be ROW_NUMBER(). Introduced in SQL 2005,...
2014-03-22
2,984 reads
When you've got only a single effective date on a record and you need to artificially create the effective end date based on a following row in T-SQL, the techniques discussed in this article will help you decide what is best.
2014-03-18
34,008 reads
Follow along as this starter article on the SQL TABLE Type walks you through the various ways it can be used in T-SQL.
2014-03-03
10,804 reads
2014-01-09
2,360 reads
A way to assign variable and overrideable defaults to input parameters to an SP or FUNCTION using a configurations table.
2013-09-03
8,431 reads
2013-09-03
2,463 reads
The SQL MERGE statement can make your DML querying more efficient but you need to take care or you may get burned
2013-04-03
24,790 reads
By Steve Jones
A bit of a photo dump, but a few fun memories for me from...
By ReviewMyDB
Part 2 of my What's New in SQL Server for the Developer series. STRING_SPLIT,...
Note: This is more of a note to myself than an attempt to preach...
Hub/Wa. 0817-819-444 Jl. Nusantara Raya No.15, Depok, Kec. Pancoran Mas, Kota Depok, DKI Jakarta...
Comments posted to this topic are about the item How to connect your SQL...
Comments posted to this topic are about the item Finding the Black Friday Sales...
We are tracking sales for Black Friday today. We have these aggregate values:
CREATE TABLE dbo.BlackFridaySales
(
Product NVARCHAR(50) NOT NULL PRIMARY KEY,
Units INT NOT NULL
);
INSERT INTO dbo.BlackFridaySales (Product, Units)
VALUES (N'55" TV', 900),
(N'Air Fryer', 500),
(N'Noise-Cancel Headphones', 500),
(N'Robot Vacuum', 300);
I'm trying to get a ranking of the sales that would return 1, 2, 2, 3 for the product levels. Which query does this? See possible answers