Click here to Skip to main content
15,860,844 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to calculate the daily and weekly averages using sql server or alternate sql softwares Pin
ZurdoDev31-Mar-20 9:52
professionalZurdoDev31-Mar-20 9:52 
AnswerRe: How to calculate the daily and weekly averages using sql server or alternate sql softwares Pin
Mycroft Holmes31-Mar-20 12:50
professionalMycroft Holmes31-Mar-20 12:50 
QuestionCreate a new Primary Key on survey table Pin
learning_new25-Feb-20 12:01
learning_new25-Feb-20 12:01 
AnswerRe: Create a new Primary Key on survey table Pin
Nathan Minier28-Feb-20 6:38
professionalNathan Minier28-Feb-20 6:38 
AnswerRe: Create a new Primary Key on survey table Pin
Eddy Vluggen28-Feb-20 9:48
professionalEddy Vluggen28-Feb-20 9:48 
AnswerRe: Create a new Primary Key on survey table Pin
David Mujica2-Mar-20 3:56
David Mujica2-Mar-20 3:56 
GeneralRe: Create a new Primary Key on survey table Pin
learning_new3-Mar-20 4:28
learning_new3-Mar-20 4:28 
QuestionIndexing question Pin
Super Lloyd5-Feb-20 13:35
Super Lloyd5-Feb-20 13:35 
Say I have this TSQL table
SQL
create table Table (
  TableId int identity(1, 1) not null,
  value nvarchar(max) null,
  id0 int null,
  id1 int null,
  id2 int null
)

and say I make a query like (getting the biggest id2 for a given id0 and id1)
SQL
declare @arg0 int = 2
declare @arg1 int = 3

select top 1 id2
from Table
where id0 = @arg0 and id1 = @arg1
order by id2 desc

What would be the better index Index1, or Index2?
SQL
create index Index1 on Table (id2) include (id0, id1)
create index index2 on Table (id0, id1, id2)
A new .NET Serializer
All in one Menu-Ribbon Bar
Taking over the world since 1371!


modified 5-Feb-20 20:52pm.

AnswerRe: Indexing question Pin
Eddy Vluggen5-Feb-20 15:09
professionalEddy Vluggen5-Feb-20 15:09 
GeneralRe: Indexing question Pin
Super Lloyd5-Feb-20 17:38
Super Lloyd5-Feb-20 17:38 
GeneralRe: Indexing question Pin
Eddy Vluggen6-Feb-20 2:50
professionalEddy Vluggen6-Feb-20 2:50 
AnswerRe: Indexing question Pin
Jörgen Andersson5-Feb-20 22:28
professionalJörgen Andersson5-Feb-20 22:28 
AnswerRe: Indexing question Pin
Richard Deeming6-Feb-20 0:17
mveRichard Deeming6-Feb-20 0:17 
Questionintegrity constraint Pin
Tara112-Feb-20 6:23
Tara112-Feb-20 6:23 
AnswerRe: integrity constraint Pin
Wendelius2-Feb-20 8:47
mentorWendelius2-Feb-20 8:47 
GeneralRe: integrity constraint Pin
Tara112-Feb-20 9:07
Tara112-Feb-20 9:07 
GeneralRe: integrity constraint Pin
markkuk2-Feb-20 23:48
markkuk2-Feb-20 23:48 
Questiontransaction recovery Pin
Tara112-Feb-20 5:46
Tara112-Feb-20 5:46 
AnswerRe: transaction recovery Pin
Eddy Vluggen3-Feb-20 3:00
professionalEddy Vluggen3-Feb-20 3:00 
QuestionCopy structure of all the tables of one database to another server Pin
Member 1473192331-Jan-20 4:58
Member 1473192331-Jan-20 4:58 
AnswerRe: Copy structure of all the tables of one database to another server Pin
phil.o31-Jan-20 5:12
professionalphil.o31-Jan-20 5:12 
AnswerRe: Copy structure of all the tables of one database to another server Pin
Eddy Vluggen3-Feb-20 3:01
professionalEddy Vluggen3-Feb-20 3:01 
Questionintegrity constraint Pin
Tara1129-Jan-20 10:36
Tara1129-Jan-20 10:36 
AnswerRe: integrity constraint Pin
Mycroft Holmes29-Jan-20 10:56
professionalMycroft Holmes29-Jan-20 10:56 
GeneralRe: integrity constraint Pin
Tara1129-Jan-20 11:05
Tara1129-Jan-20 11:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.