relational-database

Organize database & multichoice columns by cronjob

别等时光非礼了梦想. 提交于 2020-01-05 01:31:28
问题 seller: id, age, origin, gender, buyer_age, buyer_origin, buyer_gender buyer: id, age, origin, seller_age, seller_origin, seller_gender Here we want to suggest the buyer to buy from this seller AND suggest the seller to sell things to the buyer with cronjob. Doing it with one query is preferred instead of foreach seller. What's the most efficient way to do it? I don't want to SELECT each one and get info then change the query and again SELECT that's a killing process in coding and using

Converting simple MySQL database to a NoSQL solution

泪湿孤枕 提交于 2020-01-05 00:43:47
问题 I have a very small MySQL Database where the main table is about 300 records and I do add more occasionally. The table stores locations to files and some meta data for video assets that my users have access to. (movie title, path, keyframe name, movie name, file name, etc, etc) I wanted to move this table to an in-memory solution, but I am confused now-a-days as to that options there are and what is really the fastest, lightest weight, best bang for the buck. Redis? MongoDB? Something else?

Use BLOB or VARBINARY for Encrypted Data in MySQL?

妖精的绣舞 提交于 2020-01-03 16:49:36
问题 I'm working on a PHP application that accepts user input via a text area. It will be stored encrypted in the database (using AES_ENCRYPT). Should I use a BLOB or VARBINARY field? Are there performance implications for either type of field? 回答1: Both BLOB and VARBINARY are "string" data types, that store binary strings (effectively byte arrays), as opposed to the usual string types, which store character strings, with charset encoding etc. In most respects, you can regard a BLOB column as a

'Many to two' relationship

五迷三道 提交于 2020-01-03 11:39:09
问题 I am wondering about a 'many to two' relationship. The child can be linked to either of two parents, but not both. Is there any way to reinforce this? Also I would like to prevent duplicate entries in the child. A real world example would be phone numbers, users and companies. A company can have many phone numbers, a user can have many phone numbers, but ideally the user shouldn't provide the same phone number as the company as there would be duplicate content in the DB. 回答1: This question

Consolidating tables with one-to-one relationships

做~自己de王妃 提交于 2020-01-03 09:07:09
问题 I have 3 MySQL tables for a membership system. users : Minimum requirement to be a user, only related to account info (email, password, is_activated, etc) user_profiles : Personal information provided by the user (name, address, phone...) user_member_profiles : Information strictly managed by admins (registration fee paid, meetings attended, etc.) These could be condensed into one table, saving me headaches and keeping my code clean - but I feel like it's better to leave them separate as they

How can I generate this schema with Rails?

我是研究僧i 提交于 2020-01-03 05:43:06
问题 I have a schema for a relational database, which I'd like to generate scaffolding for in my Ruby on Rails 3.2.8 project. I've found the documentation pretty confusing though, and my efforts so far have failed, so my question is exactly how I'd go about generating the needed scaffolding/models for the following schema: USER name:string email:string ----- has_many: posts TAG name:string ----- belongs_to_and_has_many: series belongs_to_and_has_many: posts POST title:string body:text -----

What makes access to OLAP Cubes / Datamarts and similar datastructures, faster than to relational databases?

限于喜欢 提交于 2020-01-02 09:55:15
问题 What makes access to OLAP Cubes/Datamarts and similar datastructures, faster than to relational databases? EDIT A bounty of 200 will be provided asap. 回答1: I would say mainly because of different purposes. OLAP cubes / datamarts are used mainly in read mode for data analysis by business users whereas I'm assuming when mentioning relational DBs you're talking about OLTP usage requiring for example ACID transactions. Those different purposes means: different constraints for the implementation

Converting a SQLite Database to a triple store

*爱你&永不变心* 提交于 2020-01-02 08:39:13
问题 Can somebody please describe the steps neccessary to convert a SQLite Database to a triple store? Is there a tool that can accomplish the task? 回答1: This is a more complicated question then it seemed when I asked it, but the simple answer is that you normalize your database completely. After it is completely normalized each table stands for a predicate, one columns values represent the subject and one columns values represent the object. You can convert an arbitrary sql database to a

Multiple tables in one view?

青春壹個敷衍的年華 提交于 2020-01-02 08:12:23
问题 Today my question is how would I go about creating a view in a MySQL database that uses more than two tables? Here is my query (it works) I am not looking to change my current query, mostly looking for a nice reference with examples on this topic. CREATE OR REPLACE VIEW vw_itemsPurchased AS SELECT `tbl_buyers`.`fldPrimaryKey` as fldFKeyBuyer, `tbl_buyers`.`fldEmail` as fldBuyerEmail, `tbl_buyers`.`fldAddressStreet`, `tbl_buyers`.`fldAddressCity`, `tbl_buyers`.`fldAddressState`, `tbl_buyers`.

Database design - Similar Contact Information for multiple entities

孤者浪人 提交于 2020-01-01 16:59:31
问题 I realise that the answer to these types of questions are often "it depends" but still I wondering what the general consensus might be. I am dealing with multiple entities such as Company Charity Auditor Stocktaker etc etc... Which all have contact information such as e-mail, telephone and address. The two design methods I was thinking to store the contact info were Method 1) create role tables between the contact tables and company, charity, auditor and stocktaker. dbo.Company -> dbo