database-schema

What is the best database schema to support values that are only appropriate to specific rows?

怎甘沉沦 提交于 2019-12-28 00:50:54
问题 I have a db table called Calendar with fields Id (PK) Name Description CalendarTypeId (FK into CalendarType table) I have another table called CalendarType with fields Id (PK) Name Description The issue is that i need to store an additional field for every calendar where the calendar Type is 2. (but this field would be irrelevant for any other calendar type). Should i just create a new field in the Calendar table and ignore that field for all other calendar that have a different

Entity-Attribute-Value Table Design

若如初见. 提交于 2019-12-27 11:42:59
问题 I am currently designing a database structure for the products section of an ecommerce platform. It needs to be designed in such a way that makes it possible to sell an infinite number of different types of products with an infinite number of different attributes. E.g. The attributes of a laptop would be RAM, Screen Size, Weight, etc. The attributes of a book would be Author, ISBN, Publisher, etc. It seems like an EAV structure would be most suitable. Select a product Product belongs to

Designing and Querying Product / Review system

狂风中的少年 提交于 2019-12-25 14:12:25
问题 I created a product / review system from scratch and I´m having a hard time to do the following query in SQL Server. My schema has different tables, for: products, reviews, categories, productPhotos and Brand. I have to query them all to find the brand and category name, photos details, Average Rating and Number of Reviews. I´m having a hard time to get No. of reviews and average rating. Reviews can be hidden (user has deleted) or blocked (waiting for moderation). My product table doesn't

Designing and Querying Product / Review system

时光总嘲笑我的痴心妄想 提交于 2019-12-25 14:12:04
问题 I created a product / review system from scratch and I´m having a hard time to do the following query in SQL Server. My schema has different tables, for: products, reviews, categories, productPhotos and Brand. I have to query them all to find the brand and category name, photos details, Average Rating and Number of Reviews. I´m having a hard time to get No. of reviews and average rating. Reviews can be hidden (user has deleted) or blocked (waiting for moderation). My product table doesn't

How can I search through a SQL Server database schema to find StoredProcs with a specified set of args?

≡放荡痞女 提交于 2019-12-25 07:39:48
问题 I am trying to deduce which Stored Proc is used to return a specific set of data. The challenge is that the database has hundreds of Stored Procs. Is there a way I can query the schema to locate all StoredProcs that have parameters named, for instance: Unit Member BegDate EndDate ...or, barring that, find SPs that take four args? That would narrow things down a bit and ameliorate matters. 回答1: All of the information you want to find about stored procedures, you can find in tables like

create mongodb document with subdocuments atomically?

蹲街弑〆低调 提交于 2019-12-25 07:34:03
问题 I hope I'm having a big brainfart moment. But here's my situation in a scraping szenario; I'm wanting to be able to scrape over multiple machines and cores. Per site, I have different Front pages, I scrape (exmpl. for the site stackoverflow I'd have fronts stackoverflow.com/questions/tagged/javascript and stackoverflow.com/questions/tagged/nodejs). An article could be on every Front and when I discover an article I want to create an Article if the url is unknown, if its known I want to make

Getting a database to 1NF or 2NF - mysql

蓝咒 提交于 2019-12-25 03:12:21
问题 How do I get this mysql database in better 1NF or 2NF form? I tried my best to remove redundant data. It appears there is redundant data still in "Prof_Dept" 回答1: The schema looks strange. How can a Department by a child of Professor_Dept (with the Professor_DeptID FK in it)? That means there is no "Science faculty". You would be storing professor john's science department professor john's physics department professor tom's physics department etc I think the tables should be Professor

suggestion for creating mysql database structure

ε祈祈猫儿з 提交于 2019-12-25 02:43:33
问题 I'm currently working on building custom application. My first module already completed and now I'm still figuring out how to create the structure for second and third module to work flawlessly without any error or worst crash the whole database. Some of the info:- My first module, data are manually exported as the database is the main structure for my second and third module to work with. My second module data are logs for report, where the data automatically enter to the database upon

Advice on RoR database schema and associations

倾然丶 夕夏残阳落幕 提交于 2019-12-25 01:07:18
问题 New to RoR, but am having a stab at building an app - and I'm looking for some advice on my db structure. I've got 4 models/tables: Users > Clients > Jobs > Tasks The app will work as follows: Users will login They can add Clients They can add Jobs to Clients They can add Tasks to Jobs So, Tasks belong to Jobs, Jobs belong to Clients, and Clients belong to Users. I want to query the DB for any one of a Client, a Job, or a Task and also make sure that it belongs to the currently logged-in User

Schema Design for Invoices and Payments - better model than M:M relationship?

可紊 提交于 2019-12-24 20:08:00
问题 There is a 1:1 relationship between invoices and projects in my existing schema. I am in the process of modifying it to allow for one project to have many invoices, but I also need to track payments. Currently, a single payment relates to 1 (or more) invoices (really it's an Invoice Batch). Ideally, multiple payments per invoice can be tracked. To do that, I think there needs to be a M:M relationship between invoices and payments. So, once the data is stored, how does one determine how much