Tagged Questions
0
votes
1answer
16 views
Simple Multiplicity in Relational Database ER Diagram
I'm trying to design a database for a duty roster but i'm struggling with the multiplicity on the ER diagram.
Here is the section i'm struggling with:
The DutyRoster table in the database will act ...
0
votes
2answers
39 views
One to many relation and subqueries
I have a table persons(id, fist, last) and another table properties(person_id, property_name, property_value).
Each person may have many (undefined) properties, the name of these properties can vary ...
1
vote
1answer
46 views
Surrogate Key vs Natural Key for EF
My co-worker and I are trying to decide which is a better way to design the schema and keys for two database tables. One is a lookup-table that rarely changes. It has about 700 rows. The other ...
0
votes
0answers
29 views
Database table contains combinations of data
I'm working on a client's website, he uses MySQL for the database, I just want to confirm there's something wrong with his database design. The purpose of his site is so client's can receive a ...
2
votes
2answers
26 views
Protect against parallel transaction updating row
I'm building a simple set of queries for an SQL database. I've come across a situation I want to protect against, but I don't know the database theory terminology to explain what I'm asking.
In this ...
0
votes
1answer
17 views
Database Schema for Related Object Types
Brief background - working on a site for a non-profit where they can post 3 things:
Status updates
Needs
Events
Each of those post types can have 1 or more tags, e.g. homelessness, hunger ...
0
votes
2answers
72 views
SQL - Identify a default row
Context
I would like to know the best practice for this kind of problem.
I have two table: X and Y. Table Y has a foreign_key to table X so X has many Y. When I fetch something in table X, I need ...
2
votes
3answers
79 views
limit vs exists vs count(*) vs count(id) in MySQL
I just want to know which one is the fastest.
What I'm trying to do is to just check if the data is existing on the table.
I've been using "LIMIT" most of the time but in your opinion or if you have ...
1
vote
1answer
31 views
Choosing database paradigm
Say your data is fairly relational in nature, but the scale of your application has outgrown the performance ability of your database... Given that most NoSQL solutions out there seem to promise much ...
1
vote
2answers
31 views
database design for houses selling website in mysql
I am designing a database for a website of selling houses and lands. I have an issue that is the house may be in one or many lands, and the land may contain one or many lands depends on its area.
I ...
3
votes
5answers
71 views
Is it better to have int joins instead of string columns?
Let's say I have a User which has a status and the user's status can be 'active', 'suspended' or 'inactive'.
Now, when creating the database, I was wondering... would it be better to have a column ...
1
vote
3answers
46 views
Understanding Header and Detail tables
I have seen this in various DB but I will use the most recent example.
In the AdventurWorks2012 DB, there are
PurchaseOrderHeader
PurchaseOrderDetail
and
SalesOrderHeader
SalesOrderDetail
I am ...
0
votes
0answers
31 views
creating new database, what are my tables?
I'm having problem doing database.
Here is my two options which I have already done: http://imgur.com/IS30zqu
I have organizations which have these information:
Organization (name, place, address, ...
1
vote
2answers
38 views
How to implement that SQL query in mysql?
I am having a hard time implementing the following SQL query in mysql.
i am trying to find For every supplier that only supplies green parts, print the name of the supplier and the total number of ...
0
votes
2answers
27 views
How do we implement intersection and union in mysql?
So i am trying to Find the sids of suppliers who supply a red part and a green part.
Here is SQL query
SELECT DISTINCT C.sid
FROM Catalog C, Parts P
WHERE C.pid = P.pid AND P.color = 'red'
...
0
votes
1answer
26 views
Inbox/Messaging data model
I'm working on a project to be specific is a website wherein there is an inbox or messaging where users can send messages to other users.
I'm just looking over the net how to create a data model for ...
5
votes
3answers
55 views
Database layout/design inefficient
The image shows my proposed layout for part of a database. My concern is with the price bands and the way these attach to [shows] and [bookings]. There needs to be a list of price bands (as in titles) ...
3
votes
6answers
203 views
+50
Leaderboard design using SQL Server
I am building a leaderboard for some of my online games. Here is what I need to do with the data:
Get rank of a player for a given game across multiple time frame (today, last week, all time, etc.)
...
1
vote
1answer
39 views
Entity Framework: One to Many relationship
I have a design problem with regards to Entity Framework model relationship
I have this model in the edmx
Business Rule:
A Participant can have multiple Roles so I create a relationship table ...
0
votes
0answers
25 views
sample mysql sequence table for primary key next val
i am trying to create sequence table for my requirement.
1. i have table `'User'` where i do spring jdbc batch inserts, and i would like have id generated through code and insert with that primary ...
0
votes
0answers
28 views
Is it possible to add a MySQL partition with BIGINT instead of INT?
I have a problem with tables having a field set as INT, and it now needs to support BIGINT. I'm trying to avoid the obvious solution of rebuilding the table with the new datatype, due to limited ...
0
votes
4answers
46 views
Best solution for storing / accessing large Integer arrays for a web application
I have a Web Application (Java backend) that processes a large amount of raw data that is uploaded from a hardware platform containing a number of sensors.
Currently the raw data is uploaded and the ...
0
votes
2answers
37 views
lookup table or something else?
I have 8 tables;
employees
employee_subjects
outlet
outlet_subjects
subjects
geography
outlet_geography
employee_geography
Now, I need to be able to search out outlets and employees within a range ...
2
votes
2answers
54 views
Database design for time dependent fields
I am making a MySQL database and am fairly confident I know how to normalize it. However, there is an issue I am not sure how to deal with.
Say I have a table
users
----------
user_id primary key
...
1
vote
0answers
34 views
mysql primary key violation when application running multiple nodes
I am developing an application using MySQL and spring jdbc , I am designing a table keeping in mind in future if have multiple instance of my application access a table to insert a record
Take this ...
0
votes
1answer
38 views
Creating relationship between 2 tables in SQL
I have these 2 tables and I need to create a relationship between them so that I can import them into SSAS Tabular and run some analysis.
The first table has RollingQuarter(Moving Quarter) data. The ...
0
votes
1answer
40 views
How to reconstruct data efficiently - versioned by individual fields, only those changed
I have a legacy DB with some Tables being versioned the following way: each field individually - and only those that changed;
Table1
ObjID userID Data1 Data2 Data3
----- ------ ----- ...
0
votes
5answers
61 views
joining two tables and finding the sum of marks for each student
i have two tables of results, a mid-term result table and annual result table.
Mid-term result table:
Annual result table:
i want to join them and find the total marks of each student for each ...
0
votes
1answer
64 views
C# Entity Framework many-to-many relationship with quantity
I'm designing a database to keep inventory of office equipment, but in many cases a room will contain multiples of an identical item, like a conference room with 3 identical TV screens. Storing serial ...
0
votes
1answer
45 views
Select 2 random rows from DB but only select that combo once [closed]
I want to be able to select two random items from a table. I want to be able to continue doing this until every possible combo has been selected but without repeating any combination.
For example ...
4
votes
4answers
108 views
What is this form of database called?
I'm new to databases and I'm thinking of creating one for a website. I started with SQL, but I really am not sure if I'm using the right kind of database.
Here's the problem:
What I have right now ...
1
vote
3answers
43 views
SQL Server: Use a column to save order of the record
I'm facing a database that keeps the ORDERING in columns of the table.
It's like:
Id Name Description Category OrderByName OrderByDescription OrderByCategory
1 Aaaa bbbb cccc ...
1
vote
3answers
43 views
MySQL second auto increment field based on foreign key
I've come across this problem numerous times but haven't found a "MySQL way" to solve the issue as such - I have a database that contains users and reports. Each report has an id which I display as a ...
0
votes
3answers
75 views
Best way to normalize this data
I have two tables, 'Product' and 'Product Packs'.
One product can appear in many product packs and a product pack can have many products (A many to many relationship).
I have also created a linking ...
1
vote
2answers
53 views
Optimizing MySQL or table design
I'm puzzled with my SQL homework. I'm not an expert in databases. I'm using MySQL.
I have a table named 'news'
create table news
title text not null,
time DATE,
ip varchar(15),
...
4
votes
2answers
88 views
Storing a large amount of analytical data
I normally use SQL Server and C# for all projects I do, however I am looking upon a project that could potentially span to billions of rows of data and I don't feel comfortable doing this in SQL ...
0
votes
2answers
53 views
Naming conventions for MySQL tables
I would like to get some opinions since I am thinking about creating structure for my new application and I am struggling with names for tables so I thought maybe you can give me some ideas. App has ...
0
votes
2answers
66 views
best database diagram for this idea?
designing a database for a shop and i faced a little problem. Let's say there is a product x in our shop which has a purchase price and benefit to get retail price . But there is another supply to ...
0
votes
2answers
43 views
Structuring up a database
I have some trouble setting upp a database. Not any coding problems but can't figure it out how to structure it.
The idea is that people will sign up on the site, and with SQL they will be in the ...
0
votes
0answers
28 views
Database design for user packages and credit system
I am working on web application in which user can purchase packages. On the base of these packages user can do different operations. Currently I am using following structure.
My Questions Are.
Is ...
-2
votes
1answer
51 views
Database monitoring Scripts Automation
I am working in the configuration part of the application, so i am new to this data base side configuration.
Database Oracle,SQL,DB2
I need some clarifications on below Questions:
How to monitor ...
1
vote
1answer
88 views
query planner inaccurate choosing nested join
I have this from EXPLAIN ANALYZE
-> Nested Loop (cost=2173.66..30075.48 rows=77 width=4)
(actual time=30.949..399.463 rows=95959 loops=1)
So there's a difference in almost 3 ...
0
votes
1answer
46 views
CASE tool for database modeling on Linux
First of all, I use (x)ubuntu GNU/Linux.
I'm going to make a database project which involves: specification, modeling, design, implementation and test.
In the Entity-Relationship model, I've to use ...
2
votes
2answers
57 views
Which tables would I need If I were to keep a log of password resets
I'm really new to database design and I'd really apreciate if you could give some guidance on how to structure the tables that would be used to keep a log of password resets.
Searching a bit, I found ...
1
vote
4answers
45 views
Relationship redundant?
I'm designing a database and I have a user table with users, and a group table with user's group.
These groups will have a owner (a user that has created it), and a set of users that are part of the ...
5
votes
2answers
77 views
Represent Is“Something” Data in SQL-Server
Joe Celko (sql guru) says that we should not use proprietary data types and especially refrain from machine level things like bit or byte since SQL-Server uses a high level language. Basically that ...
-1
votes
3answers
50 views
How to represent elective courses in university database design
I am trying to design a university database for use in student management. I do not know how to represent the relationship between a student, a program, courses, and elective courses.
A student can ...
0
votes
1answer
42 views
Product quantity bound to colors and sizes table structures SQL
I've been thinking about how I'll be able to create products with sizes and colors which will match the max quantity of a product (or their total will be the max.quantity ).
Let's say I got a product ...
0
votes
1answer
41 views
How to implement Lookup Tables SQL
I'm trying to understand how to implement a lookup table for which the values will change.
For exaple:
If I have:
EmpType Type
1 FullTime
2 PartTime
3 Casual
So based on the table ...
0
votes
1answer
48 views
Database design for movie catalog
I'm designing a database for an exercise for class and am stuck in the design. In inventory system there are DVD's (divided into 3 Categories: TV, Music Vid, Movie). Within each of those categories it ...