New answers tagged schema
2
You can try creating something like this (please excuse the crudity of the image):
5
You can get rid of the anomaly by changing the FOREIGN KEY constraint (from Widgets to Carts) to include the StorageLocationID:
CREATE TABLE Widgets
( widgetID NOT NULL
, storageLocationID NOT NULL
, cartID NULL
, PRIMARY KEY (widgetID)
, FOREIGN KEY (storageLocationID)
REFERENCES StorageLocations ...
3
Your diagram has a table for Widgets with a StorageLocationID and a CartID. Not sure that makes sense logically, since the StorageLocationID refers to something physical and fixed, and the CartID can move over time.
You don't seem to be tracking things over time though, so perhaps that is the disconnect.
But when I think of this scenario I think that a ...
6
You could consider a cart to be a storage location.
Simply add attributes to the table so that a location can be identified as type "cart" or "shelf", like so:
If there's a requirement for a hierarchy - for example, if a cart might be stored in a storage location itself - you could define the hierarchy within your storagelocation table.
This is not a ...
0
Re: the big table approach
Or I could stick everything (all samples) into one big table (with hundreds of
columns) that has room for all channels and channels get added as
needed: One row per sample. Unused channels remain NULL.
I found this in the Oracle documentation:
Storage of Null Values
A null is the absence of a value in a column. ...
0
Just found out very neat explanation:
superkey: a set of attributes which will uniquely identify each tuple in a relation
candidate key: a minimal superkey
primary key: a chosen candidate key
secondary key: all the rest of candiate keys
prime attribute: an attribute that is a part of a candidate key (key column)
nonprime attribute: a nonkey column
0
Triggers are problematic because they tend to get forgotten about. I only ever use triggers for auditing purposes such as updating a "last updated datetime" column. Stored procedures and functions can be used at any time since they are called directly by processes wishing to modify data -- as opposed to triggers that are fired as the result of data being ...
1
The "Best Way" is probably to do it the former way, calculating the accurate count of messages and friends, etc is going to be easier to manage on the application side. Performance will obviously depend on how many messages and friends, some variables on the database server, and indexes.
A third solution would be to use a caching layer (like memcached) to ...
0
Why do you have Score model?
Why not keep only User and Match models and for each have a score attribute?
In this schema you have only the updates per score.
If its due to redundancy of attributes, please note this is common in a document based schema design.
7
Based on the sample table in your link, I'd suggest it's taking issue with fields such as:
phone1
phone2
or
notes1
notes2
notes3
This may indicate a design flaw (but not always), and if so, one that can probably be corrected by more descriptive field names or perhaps a child table.
For example, someone might have more than one phone number... what if ...
4
The question I would ask is whether the direct relationship between Anthology and Composer is "important" to the system? There are all kinds of incidental relationships between tangible things that are recorded in any system. However, only certain of these are important for the purposes of the system itself. These are the ones that belong in a relational ...
1
If the effect isn't required until a later point in time, I would execute the payload at that later point in time and not via trigger. This way you can collect multiple updates on the underlying table and avoid redundant calls of the DDL script.
Depending on your circumstances, a timestamp column or simple boolean flag in the underlying table might suffice ...
5
You've missed one place to get an overview of Oracle: the Concepts Guide. It covers all the major topics (including backup and recovery, which is quite important and doesn't appear in the list of links you've posted).
Whats the next step? Create the Schema or Tablespace?
Both! They're orthogonal. Users are logical entities that access your database. ...
Top 50 recent answers are included

