CrazyEngineers
  • Can key constraint application in Database be applied on a part of a single column?

    tanvisharma

    Member

    Updated: Oct 22, 2024
    Views: 1.4K
    As we know in data bases Key Constraints is the most important concept.
    we can apply the key constraint either to column level or table level, but
    I want to know is there any possibility that a unique key be applied only on to a part of a single column?
    I was asked this question by one of my friends, as far as i know there is no concept like that.

    example there is a column named timestamp and value in that column is like 2014-06-23 01:02:03
    so i want to apply unique key based on time only, ignoring the date.
    is that possible?

    So please help me know if there is any possibility.
    0
    Replies
Howdy guest!
Dear guest, you must be logged-in to participate on CrazyEngineers. We would love to have you as a member of our community. Consider creating an account or login.
Replies
  • Nayan Goenka

    MemberJun 23, 2014

    Technically not directly. Ull have to define a rule where the characters preceding the checkarea n following it would have to be masked. So ur basically splitting the value.

    Another approach can be through checksum
    Are you sure? This action cannot be undone.
    Cancel
  • tanvisharma

    MemberJun 23, 2014

    thank you Nayan 😀
    but can you be more precise?
    i am talking about databases.
    i am not aware about masking thing, can u help me know how?
    Are you sure? This action cannot be undone.
    Cancel
  • Manish Goyal

    MemberJun 23, 2014

    No you can't, at database level
    Are you sure? This action cannot be undone.
    Cancel
  • tanvisharma

    MemberJun 23, 2014

    ok thank you
    Are you sure? This action cannot be undone.
    Cancel
Home Channels Search Login Register