database-design

How can I parse delimited list in string to rows?

旧城冷巷雨未停 提交于 2020-06-17 06:21:16
问题 This is my previous question: How can I merge two strings of comma-separated numbers in MySQL? I tried to use delimited list with these reasons: the data is more than 2000 rows. I have just one day. this is not production level I need to parse the data with my hands. I thought I don't have any choice. But I found this: SQL split values to multiple rows So, I got some hopes from it. But it's quite difficult to apply it to my table. Mine is different form. I have multiple columns and I'd like

Table design in DynamoDB

↘锁芯ラ 提交于 2020-06-17 02:03:06
问题 I am a beginner in NoSQL DB and Serverless. My app has a table called Trips . The parameters of the tables are {id, route, cost, selling, type, date, LR, asset } and a bunch of other irrelevant document numbers, where id is generated by uuid. Now I want to query the database for giving me Return all trips between a date range using the date parameter. Return all the trips for an asset in given period of time using date and asset parameter. Return all the trips for a route in a given period of

MYSQL - One Column Referenced to Multiple Table

安稳与你 提交于 2020-06-12 06:48:08
问题 Can a single column in a table can be referenced to multiple tables? 回答1: A very late answer, but for whoever is wondering & googeling. YES this can be done, but it is NOT good practice and even though it is quite simple, it will probably blow up in your face if you're not very aware of what you are doing. Not recommended. However, I can see uses. For instance, you have a large table of millions of records, and you want in exceptional cases link to unknown or multiple tables (in which case it

Firebase - Targeting Specific Firestore Document Field with Cloud Functions

╄→гoц情女王★ 提交于 2020-06-10 09:16:37
问题 When using Cloud Functions with the Firebase Realtime Database you are able to target a specific field with a cloud function. For example, given this JSON structure, I could target when user1's email field changed with a ('/user/{userId}/email').onUpdate cloud function. { "user": { "user1": { "name": "John Doe", "phone": "555-5555", "email": "john@gmail.com" } } } Now with Firestore it seems that I can't target a specific field and can only target documents. If this is the case a Firestore

Social web application database design: how can I improve this schema?

爱⌒轻易说出口 提交于 2020-06-09 07:54:37
问题 Background I am developing a social web app for poets and writers, allowing them to share their poetry, gather feedback, and communicate with other poets. I have very little formal training in database design, but I have been reading books, SO, and online DB design resources in an attempt to ensure performance and scalability without over-engineering. The database is MySQL, and the application is written in PHP. I'm not sure yet whether we will be using an ORM library or writing SQL queries

How do I create boundaries for my microservices?

余生颓废 提交于 2020-06-01 05:13:51
问题 We have a monolithic web based CRUD application (call it A ) which does a certain task. Now, we have a new requirement which is more or less independent of A functionally. The audience is different, the times of use, the functionality etc. are all different. Because of this, we decided to build this into a new service B . The problem started when B required authentication information from A . Anticipating that this might happen again, we pulled out the auth from A and put it as separate

Linear database design

懵懂的女人 提交于 2020-05-29 09:55:45
问题 I have a question about database relationship I am trying to build a monitoring system with the following rules : Channels belongs to one Sensor Sensors belongs to one Device Devices belongs to one Probe Probes belongs to one Core Here is a preview of the tables +-------------+ +-------------+ | Cores | | Probes | +-------------+ +-------------+ | id | | id | | fields ... | | fields ... | +-------------+ | core_id | +-------------+ +-------------+ +-------------+ +-------------+ | Devices | |

Linear database design

孤者浪人 提交于 2020-05-29 09:53:06
问题 I have a question about database relationship I am trying to build a monitoring system with the following rules : Channels belongs to one Sensor Sensors belongs to one Device Devices belongs to one Probe Probes belongs to one Core Here is a preview of the tables +-------------+ +-------------+ | Cores | | Probes | +-------------+ +-------------+ | id | | id | | fields ... | | fields ... | +-------------+ | core_id | +-------------+ +-------------+ +-------------+ +-------------+ | Devices | |

What are the advantages of explicitly setting up relationships inside of a database

蹲街弑〆低调 提交于 2020-05-28 03:34:53
问题 When your creating a database schema and come up with all the foreign keys. What are the advantages of explicitly defining them as such in the database? Are there advantages? If it's reliant MySQL is the db I will be using. 回答1: Foreign key constraints are used for maintaining Referential Integrity which is a database constraint that ensures that references between data are indeed valid and intact (a database should not only store data but should also ensure its quality). In other words, they

Why specify a length for character varying types

╄→гoц情女王★ 提交于 2020-05-25 11:31:27
问题 Referring to the Postgres Documentation on Character Types, I am unclear on the point of specifying a length for character varying (varchar) types. Assumption: the length of string doesn't matter to the application. you don't care that someone puts that maximum size in the database you have unlimited hard disk space It does mention: The storage requirement for a short string (up to 126 bytes) is 1 byte plus the actual string, which includes the space padding in the case of character. Longer