I need to design a database schema. My data is as follows: Product Id (Primary Key), Product Name (String), Product Type (String), Item Count (INT), Tags (Array of Strings) My requirements: I need to frequently query Products based on Tags. It is a many-to-many relationship – Each Product Id could have many Tags and each tag could have many Product
Tag: database-design
Keep a foreign key NULL if info is easily determine?
I have the following tables: An image can have a country (or not) or a place (or not). Let’s say that I have a record in the country table: And places in the place table: I want to tag an image with the country Spain and a place Barcelona In the image table, should I enter the country_id and the
SQL column default value set using row wise operations
Is it possible to set a default value in a SQL column to be consisted of other columns? For example, in the table below is it possible to have the EndDate default to StartDate + NoOfDays? So when …
How to transform complex form/poll questions to SQL tables?
I need to make system design out of some big form/poll and transform all of that in SQL tables and make db out of it. My problem are questions in which user can choose answer or if the answer is not preset to write it down. So for example question is: Where did you bought your groceries? 1 – walmart
How to make Custom attributes for SQL table
What is the proper way to give user to use custom attributes ? As an example Consider that, There is a web application, using the frontend user interface admin user need to be able to add custom …
Advice on database design – SQL recipe editor
I want to build an SQL-based recipe editor for a brewery. I have n recipes: Every recipe is part of a category. Every category has a list of steps. Steps can be reused in the same category several times and in different orders. Every step has n set-points. Setpoints change based on the recipe. The same steps used more than
Simple database with 3 tables and “no matching unique or primary key for this column”
I have three tables, two are created independently, and the third one is created to include some inputs from the first two. First two tables have no problems, however, when I try to create the third one, I get an error: The thing is, I created the third table by copy/pasting the column names/definitions right from the first two tables,
Is table order imporant in mysql when creating relation between them?
I have quite simple question. I am creating database administration tool, where user will be able to create relations between tables, but I am not sure if table order is important when creating relations. For example: I have two tables ‘user'(user_id(INT, PRIMARY KEY), name(VARCHAR), email(VARCHAR)) and ‘post'(post_id(INT, PRIMARY KEY), content(TEXT), author(INT)). When user has selected one column from both tables
How to structure the database to avoid duplicates in a table
I am doing this exercise where I have to build an sql database (MySql) to store information on private lessons offered by teachers. These are the rules: There is just one predifined week with slot times from Monday to Friday (15-19) Each teacher can teach 1 or more courses Each course can be teached by multiple teachers One user can
PostgreSQL / express rookie – create new table or just a new column in existing table? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question This will probably get closed for being opinion based but hopefully I can get a comment or two. I’m building a social media app (Express/Postgres/React)