Skip to content
Advertisement

Tag: database-design

Check the number of digits or their range

I tried to create a table for save Tradeshows and I need to save Year and Month into different columns. I have a problem with my back-end and front-end developers for check data. I need to check years is 4 number and month between 1-12. Speed is important to me. Answer Just use check constraints: Or, you could get fancy

What’s best practice for normalisation of DB where a domain table has an “Other” option for free text?

I’m currently in the process of normalising a database for my company and one pattern I’m seeing a lot in this database is using a domain lookup table for a value but also allowing “Other” and storing the results in a separate column. My question is just whether there is perhaps a cleaner way of representing this? For context I’m

How I can update one to many relation in Postgres?

Here is my first table question. Questions have many options, so I referring every option row with question_id Now, How can I update both tables in one query? I building an API. The below-given output is for request. The request will response with question details and options for the question. I am able to update question but questions have many

Why store whole records in audit tables?

I worked in several companies and in each of them audit tables have been storing full snapshots of records for every change. To my understanding it’s enough to store only changed columns to recreate record in any given point of time. It will obviously reduce storage space. Moreover I suppose it would improve performance as we would need to write

MySQL return total COUNT of each value in a column

I have a table of jobseekers with three columns Each jobseeker could have different hiring status for each employer depending on the interview. Now I want to return the COUNT of each total HIRING STATUS But it should only count the jobseeker’s highest hiring status. Say that John was ranked as QUALIFIED by employer 1 and HIRED by employer 2

Advertisement