Skip to content

Tag: database-design

How do I correctly map letters in the database?

I have two tables. One table with the letters of different countries and a second table with a mapping of these letters to each other. I need to make a query to get the mapped letters of the two languages. Can you tell me how this can be done optimally? The letter table id letter language 1 A en 2

How to add a column default?

I created a Postgres DB which contains 5 tables. Then I realized that the column student.student_id lacks a column default to generate an UUID: Knowing that some tables are linked to the student table, how can I add to the function as column default for student_id so that the result will be: Answer Use ALTER TABLE: Column defaults do not

Create database scripts where tables have prepopulated data across environment

I have a table named, ‘[UserTypes]’ where Primary id is [uniqueidentifier]. and I have a reference in another table called ‘[Users]’. Users table has UserTypeId as foreignKey. This ’80D1EEE7-0BCC-48A7-A741-29A1D8B6E580′ is the userTypeId of ‘ADMI’ from the userType Table. My problem is, Suppose, I need to run this script in a new DB, then my ID for ‘ADMI’ will be different

Data Model for multiple checkboxes

I currently have a supplier table and now I want to store the regions served by each supplier. As a first thought, I made my supplier model like this : Does this seem to be a good pattern? Especially for queries to filter suppliers by region served etc. Is this solution still reliable if in the future I want to