Home
How It Works
Daily Challenge
Contact

Companies
Register
Login
Recruiter Tools
Post SqlAds
Resume Razor
Candidates
Register
Login
My Info
Employment
Submit Question
Training
Intro to
Informatica
Ask Mark
Recent Topics
Resume Courier
Top 10
grabowski
vlg
anjugarg
billw
jjahns
drj
nisha
nishardhini
grifman
kalaabhyas
 

Pete Russitano Design >


Yesterdays Results
86% Correct
14% Incorrect
Sponsored Jobs
DataStage Developer
Iowa, IA
DataStage, Informatica, Oracle, Team Leader   more...
Contact Us
Data Analyst
Shelton, CT
MSAccess, SQL Sever, SQL, DBase, Clipper, Foxpro   more...
Contact Us
Database Programming Specialist
Atlanta, GA
Advanced SQL query experience; - Five years of experience in software development; - Experience in building web-based programming applications with relational databases in a multi-tier environment   more...
Contact Us
Production Support Analyst - Unix, FTP
Bristol, CT
Momentum, Odin, ConnectDirect, Tidal, BARR, and Tandem application and O/S software   more...
Contact Us
Data Modeler
Shelton, CT
UML, Rational, RequisitePro   more...
Contact Us
DB2 DBA
New Haven Area, CT
DB2, DBA, Logical & Physical Modeling   more...
Contact Us
Project Manager (Multiple)
Windsor, CT
Junior to Senior Level Project Managers with Insurance Background   more...
Contact Us
Saiko Consulting's SqlChallenge
Saiko Consulting's SqlChallenge
CareerFactor
Saiko Consulting

Read A Topic

Return To Topics Originally Posted:  6/10/2006 9:47:09 PM
  Last Updated:  6/10/2006 9:47:09 PM

Subject:
Composite Indexes and column orders

You Asked....
Say for instance I have a table called 'Employees' and I create a composite index on LastName and FirstName.

I know that a SQL statement will use the index when querying by LastName and LastName, FirstName

But what about when querying by FirstName alone or FirstName, LastName

and we responded....
Actually any variation of FirstName and LastName will utilize the Index.

This confused me also when I first started with SQL programming.

I came from an AS/400 -- RPG world and whenever querying a table via RPG you always needed to have an index in the exact order of the query. So for example, if you wanted to look by FirstName/LastName and LastName/FirstName you would need two indexes.

Not true in the SQL world


others said.... Post Your Own Review

Review By:  Posted From IP Address: 69.229.110.12

Are there any differences while using Oracle or SQL server or the rule holds true for both of them?

Thanks!

>>>>>Begin Original Message<<<<<

Say for instance I have a table called 'Employees' and I create a composite index on LastName and FirstName.

I know that a SQL statement will use the index when querying by LastName and LastName, FirstName

But what about when querying by FirstName alone or FirstName, LastName

>>>>>End Original Message<<<<<

Review On:  6/14/2006 11:47:51 AM