What I’m trying to do is build a table of unique sets of rows. What is the aim? I’m building an app for a service provider (let’s say cable company for example). Every customer has a set of …
Tag: database-design
Seperate tables with same attributes in SQL
When using SQL database, when I have tables with same attributes. For example if I have [posts] with attributes (id, image, description, number of likes and dislikes) [Comments] with attributes (id, image, description, number of likes and dislikes) and [Replies] with attributes (id, image, description, number of likes and dislikes) and I have another type of posts, comments, replies for
Data model guidance, database choice for aggregations on changing filter criteria
Problem: We are looking for some guidance on what database to use and how to model our data to efficiently query for aggregated statistics as well as statistics related to a specific entity. We have different underlying data but this example should showcase the fundamental problem: Let’s say you have data of Facebook friend requests and interactions over time. You
How to optimize a MySQL query which is taking 10 sec to fetch results
I have a MySQL database. I have a table in it which has around 200000 rows. I am querying through this table to fetch the latest data.Query select * from `db`.`Data` where floor = “floor_value”…
avoiding write conflicts while re-sorting a table
I have a large table that I need to re-sort periodically. I am partly basing this on a suggestion I was given to stay away from using cluster keys since I am inserting data ordered differently (by time) from how I need it clustered (by ID), and that can cause re-clustering to get a little out of control. Since I
How to represent X and Y axis data in an SQL table
I have a table of data in excel that looks like this: I need to get this data imported into an SQL table. Eventually I need to be able to query the table by saying something like: Select the value where x-axis equals 762 and y-axis equals 889 – this should return 30.60. What is the best way to represent
Replace comma separated list stored in database
I have a table with a field named Schedule with data type varchar(20) that currently holds a comma separated list of up to six (6) two (2) character schedule codes. Theses codes range from [a1-a9]-[g1-…
Primary key requirements
Is it a good idea to store phone number as a primary key on RDBMS? They are unique to nearly all of us. But my friend suggests it is not a good idea because of the following reasons. What if two …
Relational Databases: Is it fine to have a foreign key referencing an Associative table?
Lets say we have Passengers, where Passengers can attend many Flights, and one Flight may have many Passengers. In each Flight, each Passenger has a unique selection of Movies he/she can watch. For Passengers, Flights, and the association between them, we have three tables: For Movies, it must specify for which Passenger and for which Flight will it be available
How to design entity tables for entities with multiple names
I want to create a table structure to store customers and I am facing a challenge: for each customer I can have multiple names, one being the primary one and the others being the alternative names. …