relational-database

How to get started with RDF? (Particularly for relational database developers?)

我的未来我决定 提交于 2019-12-09 06:30:23
问题 I am putting together a catalog (catalogs by nature are just metadata), and so rather than using a database, I am using an RDF store and SPARQL processor to compile the data. I am at the pattern-matching stage (the fun part). So, I get to come up with lots of patterns that are simple to define in SPARQL, and then provide that information to the people who use the catalog. Ok, here's my question: I have worked on a few projects using RDF, and it seems like getting started is the hardest part

Import Excel Data to Relational Tables at MySQL

≯℡__Kan透↙ 提交于 2019-12-09 00:50:23
问题 I have three tables at my MySQL database. First one is cities, second one is towns and third one is districts. Every town has many districts. My table details: cities: cityid, city name towns: townid, cityid, townname, continent districts: districtid, townid, districtname I have an excel file that holds the town and district names of one city. It has three columns. city name, town name, district name city name is always same at this excel sheet. town name has duplicates because of its

Buddy List: Relational Database Table Design

三世轮回 提交于 2019-12-09 00:10:55
问题 So, the modern concept of the buddy list: Let's say we have a table called Person. Now, that Person needs to have many buddies (of which each buddy is also in the person class). The most obvious way to construct a relationship would be through a join table. i.e. buddyID person1_id person2_id 0 1 2 1 3 6 But, when a user wants to see their buddy list, the program would have to check the column 'person1_id' and 'person2_id' to find all of their buddies. Is this the appropriate way to implement

MySQL second auto increment field based on foreign key

白昼怎懂夜的黑 提交于 2019-12-08 22:34:03
问题 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 report number to my users. The main complaint is that users are confused as to why reports have gone missing from their system. This is not actually the case. It is actually that they are recognizing a gap between their IDs and assume that these are missing reports, when in actual fact, it is

normalization transitive dependencies

放肆的年华 提交于 2019-12-08 21:49:30
I need help with normalization. I am having trouble understanding how to complete the 3NF on my database project. Here is the 1NF Normalized Table Donut ID(PK) Donut Name Description Unit Price Donut Order ID Qty CustomerID Last Name First Name Last Name Street Address Apt City State Zip Home Phone Mobile Phone Other Phone Order Date Special Notes 2NF Donut Table DonutID (PK) Donut Name Description Unit Price Sales Order Table Sales OrderID (PK) CustomerID Last Name First Name Last Name Street Address Apt City State Zip Home Phone Mobile Phone Other Phone Order Date Special Notes Sales Order

Difference between END transaction and COMMIT transaction

瘦欲@ 提交于 2019-12-08 20:01:04
问题 I am trying to simulate a database recovery subsystem using java. However, I have the following questions. Whenever begin transaction is issued, is it always necessary that there should be an end transaction? (Like the below example) b1 --- Begin txn 1 r1(X) --- Read item X using txn 1 e1 --- End txn 1 As per the above example, I am not issuing a Commit transaction statement. So, will my transaction succeed or fail? If the above example, is as below, b1 --- Begin txn 1 r1(X) --- Read item X

Why does SQL standard allow duplicate rows?

前提是你 提交于 2019-12-08 17:11:42
问题 One of the core rules for the relational model is the required uniqueness for tuples (rows): Every individual scalar value in the database must be logically addressable by specifying the name of the containing table, the name of the containing column and the primary key value of the containing row. In a SQL world, that would mean that there could never exist two rows in a table for which all the column values were equal. If there was no meaningful way to guarantee uniqueness, a surrogate key

How to efficiently design MySQL database for my particular case

[亡魂溺海] 提交于 2019-12-08 15:28:57
问题 I am developing a forum in PHP MySQL. I want to make my forum as efficient as I can. I have made these two tables tbl_threads tbl_comments Now, the problems is that there is a like and dislike button under the each comment. I have to store the user_name which has clicked the Like or Dislike Button with the comment_id . I have made a column user_likes and a column user_dislikes in tbl_comments to store the comma separated user_names. But on this forum, I have read that this is not an efficient

TypeORM add custom column without losing object tree

房东的猫 提交于 2019-12-08 14:15:44
问题 following the docs if i want to add a custom column to the select eg. "sum(a.id) as count" i have to add ".getRaw...()", if i have a join (table A one to may table B) i'm losing the object tree ( [{id: 1, bs: [...]}] ) and the result is the raw sql list of repeated A rows ( [{id: 1, b_id: 1}, {id: 1, b_id: 2}] ) This is how i do it in sequelize const user = await User.findOne({ attributes: ['id', [Sequelize.fn('COUNT', Sequelize.col('id')), 'no_hats']], include: [ { model: UserKey, as: 'keys'

Writing the following query using relational algebra

心已入冬 提交于 2019-12-08 14:12:09
问题 I am trying to write the following query using the relational algebra: "Find the names of sailors who reserved a red or a green boat" Here is my solution: But the book gives the following solution: And another equivalent solution given by book: End here is the related tables: My question is, can't we use the "or" symbol (V) in selection operator? Is my solution wrong? Why do we need renaming operator? Thanks 回答1: Yet more proof that there is no such thing as "the" relational algebra. As for