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 4270296
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:17:11+00:00 2026-05-21T07:17:11+00:00

Currently I’m working on a RFID project where each tag is attached to an

  • 0

Currently I’m working on a RFID project where each tag is attached to an object. An object could be a person, a computer, a pencil, a box or whatever it comes to the mind of my boss.
And of course each object have different attributes.

So I’m trying to have a table tags where I can keep a register of each tag in the system (registration of the tag). And another tables where I can relate a tag with and object and describe some other attributes, this is what a have done. (No real schema just a simplified version)

enter image description here

Suddenly, I realize that this schema could have the same tag in severals tables.
For example, the tag 123 could be in C and B at the same time. Which is impossible because each tag just could be attached to just a single object.

To put it simple I want that each tag could not appear more than once in the database.

My current approach
enter image description here

What I really want
enter image description here

Update:
Yeah, the TagID is chosen by the end user. Moreover the TagID is given by a Tag Reader and the TagID is a 128-bit number.

New Update:
The objects until now are:

— Medicament(TagID, comercial_name, generic_name, amount, …)

— Machine(TagID, name, description, model, manufacturer, …)

— Patient(TagID, firstName, lastName, birthday, …)

All the attributes (columns or whatever you name it) are very different.

Update after update

I’m working on a system, with RFID tags for a hospital. Each RFID tag is attached to an object in order keep watch them and unfortunately each object have a lot of different attributes.

An object could be a person, a machine or a medicine, or maybe a new object with other attributes.

So, I just want a flexible and cleaver schema. That allow me to introduce new object’s types and also let me easily add new attributes to one object. Keeping in mind that this system could be very large.

Examples:

Tag(TagID)
Medicine(generic_name, comercial_name, expiration_date, dose, price, laboratory, ...)
Machine(model, name, description, price, buy_date, ...)
Patient(PatientID, first_name, last_name, birthday, ...)

We must relate just one tag for just one object.

Note: I don’t really speak (or also write) really 😛 sorry for that. Not native speaker here.

  • 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-21T07:17:12+00:00Added an answer on May 21, 2026 at 7:17 am

    You can enforce these rules using relational constraints. Check out the use of a persisted column to enforce the constraint Tag:{Pencil or Computer}. This model gives you great flexibility to model each child table (Person, Machine, Pencil, etc.) and at same time prevent any conflicts between tag. Also good that we dont have to resort to triggers or udfs via check constraints to enforce the relation. The relation is built into the model.

    diagram

    create table dbo.TagType (TagTypeID int primary key, TagTypeName varchar(10));
    insert into dbo.TagType
        values(1, 'Computer'), (2, 'Pencil');
    
    create table dbo.Tag
    (   TagId       int primary key, 
        TagTypeId   int references TagType(TagTypeId), 
        TagName     varchar(10),
        TagDate     datetime,
        constraint UX_Tag unique (TagId, TagTypeId)
    )
    go
    create table dbo.Computer 
    (   TagId       int primary key, 
        TagTypeID   as 1 persisted,
        CPUType     varchar(25),
        CPUSpeed    varchar(25), 
        foreign key (TagId, TagTypeID) references Tag(TagId, TagTypeID)
    )
    go
    create table dbo.Pencil 
    (   TagId       int primary key, 
        TagTypeId   as 2 persisted,
        isSharp     bit,
        Color       varchar(25),
        foreign key (TagId, TagTypeID) references Tag(TagId, TagTypeId)
    )
    go
    
    
    
    -----------------------------------------------------------
    -- create a new tag of type Pencil:
    -----------------------------------------------------------
    insert into dbo.Tag(TagId, TagTypeId, TagName, TagDate)
        values(1, 2, 'Tag1', getdate());
    
    insert into dbo.Pencil(TagId, isSharp, Color)
        values(1, 1, 'Yellow');
    
    -----------------------------------------------------------
    -- try to make it a Computer too (fails FK)
    -----------------------------------------------------------
    insert into dbo.Computer(TagId, CPUType, CPUSpeed)
        values(1, 'Intel', '2.66ghz')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently working on database part of android project. The main aim of the project
Currently i m working on a project where there are users with four roles
Currently I have a DetailsView attached to a GridView. When you select an item
Currently I'm prototyping search with Lucene.Net-2.0-004 on a web application. It's working very well,
Currently I am adding object by creating it like: type TRecord = class private
I want use html5's new tag to play a wav file (currently only supported
Currently, Tapping on the same Tab (in which user is working), The App moves
Currently i am working on 1 site, its requirement is that, i have to
Currently, working with RC0 Denali, having some issues I am attempting to review data
currently i am modifying an existing CakePhp project and i'd like to set a

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.