I am designing schema for a simple quiz application. It has 2 tables - "Question" and "Answer Choices". Question table has 'question ID', 'question text' and 'answer id' columns. "Answer Choices" table has 'question ID', 'answer ID' and 'answer text' columns. With this simple schema it is obvious that a question can have multiple answer ...
I have an Postgre database and a table called my_table. There are 4 columns in that table (id, column1, column2, column3). The id column is primary key, there are no other constrains or indexes on columns.
The table has about 200000 rows.
I want to print out all rows which has value of column column2 equal(case insensitive) to 'value12'...
This sounds kinda dumb, but I have a sharded DB that I no longer think I need to run on 2 machines, and would like to run on one single machine instead.
Any ideas on how that can potentially be done? There are lots of resources on how i can achieve the converse, but very little on how this can be done
...
I am using php and mysql. If I want to do a sharing photos website, whats the best database design for upload and display photos. This is what I have in mind:
domain:
|_> photos
|_> user
Logged in user will upload photo in
[http://www.domain.com/user/upload.php]
The photos are stored in filesystems, and the path-to-photos st...
Suppose I have two tables, Customer and Vendor. I want to have a common address table for customer and vendor addresses. Customers and Vendors can both have one to many addresses.
Option 1
Add columns for the AddressID to the Customer and Vendor tables. This just doesn't seem like a clean solution to me.
Customer Vendor ...
we have a big portal that build using SharePoint 2007 , asp.net 3.5 , SQL Server 2005 .. many developers work in it since 01/2008 and we are now doing huge analysis for current SQL Databases [not share-point DB ] to optimize and enhance it.
The main db have about 330 table and 1720 stored procedure (SP) created from 01/2008 till now
Ma...
Hello,
An example would set the context right, the example below captures the various states of the entity, which needs to be reverted(rolled back) .
State 1 - Recorded on 01-Mar-2010
Column1 Column2
Data1 0.56
State 2 - Recorded on 02-Mar-2010
Column1 Column2
Data1 0.57
State 3 - Recorded on 03-Mar-2010
Column1 Column2
Da...
I have two domains :
class CodeSetDetail {
String id
String codeSummaryId
static hasMany = [codes:CodeSummary]
static constraints = {
id(unique:true,blank:false)
}
static mapping = {
version false
id column:'code_set_detail_id', generator: 'assigned'
}
}
and :
class CodeSummary {
String i...
Hi all - I'm designing a library management system for a department at my university and I wanted to enlist your eyes on my proposed schema. This post is primarily concerned with how we store multiple copies of each book; something about what I've designed rubs me the wrong way, and I'm hoping you all can point out better ways to tackle...
I would like to ask about the design of table based on it's editability in a Grid View. Let me explain. For example, I have a table named ProductCustomerRel.
Method 1
CustomerCode varchar PK
ProductCode varchar PK
StoreCode varchar PK
Quantity int
Note text
So the combination of the CustomerCode, StoreCode and ProductCode must be u...
Hey guys,
I have a question that is more in the realm of design, than implementation.
I'm also happy for anyone to point out resources for the answer and I'll gladly,
research for myself.
Highly simplified Java and SQL:
Say I have a business domain POJO called 'Picture' with three attributes.
class Picture
int idPicture
Str...
Hi, i'm developing text ads system. Some small clone of Google Ads
Updated image so all field names would be seen
if you don't seen diagram, click here
Here is diagram with common tables.
Basically make it short, advertiser can have up to 10 variant of same campaign with different text variations, can geo-target his ads and unique im...
Say I have a simple helpdesk application which logs calls made by users.
I would typically have such fields in a table relating to the call e.g. CallID, Description, CustomerID etc.
I Would also have a table of customers including CustomerID, Username, Password, FullName etc.
Now when a user is deleted from the customers table then th...
After reading this question, I've learned that denormalization is not a solution for simplicity. What about this case?
I have news-articles which have a list of sites-article-will-be-published-to. The latter can be expressed in normalized fashion either by table and a many-to-many relationship (via a cross-table, I think). But the simpl...
Hi,
I'm not really sure I'm using the good terms, so I'll try to explain my problem first.
I have a cross-reference table, CompetenceCollab, containing the associations between people and their competences. This table has two primary keys, the people's id, and the competence's id. To this point, everything is ok.
However, the new feat...
I have expressions like this:
(cat OR cats OR kitten OR kitty) AND (dog OR dogs) NOT (pigeon OR firefly)
Anyone having idea how to make tables to save those?
Before I got request for usage of brackets, I limited usage of operators to avoid ambiguous situations. So only ANDs and NOTs or only ORs and saved those in this manner:
operat...
I don't do database work that often so this is totally unfamiliar territory for me.
I have a table with a bunch of records that users can update. However, I now want to keep a history of their changes just in case they want to rollback. Rollback in this case is not the db rollback but more like revert changes two weeks later when they r...
I am building a database similar to the one described here where I have products of different type, each type with its own attributes.
I report a short version for convenience
product_type
============
product_type_id INT
product_type_name VARCHAR
product
=======
product_id INT
product_name VARCHAR
product_type_id INT -> Foreign key t...
Hi folks, I have an interesting database problem. I have a DB that is 150GB in size. My memory buffer is 8GB.
Most of my data is rarely being retrieved, or mainly being retrieved by backend processes. I would very much prefer to keep them around because some features require them.
Some of it (namely some tables, and some identifiable ...
I've an entity LearningUnit that has an int primary key. Actually, it has nothing more.
Entity Concept has the following relationship with it:
@ManyToOne
@Size(min=1,max=7)
private LearningUnit learningUnit;
In a constructor of Concept I need to retrieve the LearningUnit with the greatest primary key. If no LearningUnit exists ...