Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6556125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:54:16+00:00 2026-05-25T12:54:16+00:00

If I have a table with the following columns as the primary key: Username,

  • 0

If I have a table with the following columns as the primary key: Username, Title, Start Date, then the database will automatically create an index on it.

  1. If I want to select by username, and start date for a query…..will it use the index above OR do I need to specify an additional index?
  2. If title and start date identify uniquely but I also add username to the primary key, would that make it a superkey?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:54:16+00:00Added an answer on May 25, 2026 at 12:54 pm

    1) If I want to select by username, and start date for a query…..will it use the index above OR do I need to specify an additional index?

    You have a complex condition, say, like this:

    username = 'blah-blah-blah' AND startdate > '01.01.2010'
    

    If your table’s PK defined like:

    PRIMARY KEY (Username, Title, StartDate)
    

    Then index will be used for first part involving username field. startdate values will be evaluated in natural order.

    If you want index to be used for both parts of complex condition, either create additional index on startdate or change order of fields in the PK:

    PRIMARY KEY (Username,  StartDate, Title)
    

    2) If title and start date identify uniquely but I also add username
    to the primary key, would that make it a superkey?

    It is a good practice not to abuse an unique index with additional fields. In your case create PK on title and start date and then (if necessarily) create separate index on user name field.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a messages table with the following columns: id (primary Key) username timestamp
In a MySQL database I have a table with the following primary key PRIMARY
I have the following tables: create table Users( Id uniqueidentifier primary key, InfoId uniqueidentifier
I have a table with the following columns: ConnectionId INT - primary key, identity,
I have a mysql table with the following columns: id (autoincremented primary key) user_id
I have a table 'tickets' with the following columns id - primary key -
I have a table in my database with columns: Lead_id INT(11) PRIMARY KEY NOT
I have a table in SQL Server with the following columns: id int (primary
I have a database table containing the following columns: id code value datetime timestamp
I have a table balances with the following columns: bank | account | date

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.