Is this possible in sql? Pratically its possible
can we have update and delete together in one single query?
Assume a table
Table (refcount INTEGER, Name STRING)
Name: is the name of the patient in the hospital,
RefCount: is the number of people with the same name.
Now at the time of addition to the table i must check whether that name already exists, if it exists increment the refcount by 1, if it doesn't insert (1, the given name). Can i do this in single step? Practically its possible to do this in single search of the table. How do we do it in SQL with single search on table?
Likewise i want the delete operation. If a patient is discharged, his name refcount should be reduced by 1, and if the refcount bercomes zero then that row entry must be deleted. Again we have similar situation, Practically its possible to do this in single search of the table. How do we do it in SQL with single search on table?
__________________
Regards,
Phani
|