relational-database

Class diagram conversion to relational model; Inheritance, and a table for matching

可紊 提交于 2019-12-14 04:20:05
问题 For a school project, I'm supposed to design the systems of a previous semester's project. We're using UML, creating an extremely simple use case diagram (no <<extend>> type nonsense, just actors pointing at use cases inside of a system), from which we make a class diagram, then a relational model. Use Case and Class Diagram attempts: The last diagram is just me eventually thinking that maybe my use cases were the issue. My application lets people/restaurants list food they're willing to

Normalised database - ONE to MANY - Search through all joined data sets

蹲街弑〆低调 提交于 2019-12-14 04:18:25
问题 I am trying to construct a MySQL query that will allow me to pull the song title of a track in the database that has a genre of both Pop and Electronic. +----------------------------------------------------+ TABLE: SONG +----------------------------------------------------+ song_id | title | 1 | song name | +----------------------------------------------------+ TABLE: GENRE +----------------------------------------------------+ genre_id | name | 1 | Pop | 2 | Electronic | +-------------------

How to design these two tables?

亡梦爱人 提交于 2019-12-14 03:36:23
问题 I want to build an application that allows a user to build its own form(s). A user can input data into its form and query the data too. The form can be edited after being created and used ( add/remove fields from it ). The form can have small text box, big text box, single list, check box, or a drop down menu. I've been reading and asking around about which approach is better for building this kind of databases and I got no straight/good answer. I read that in this kind of application, the

Should this ER diagram use a ternary relationship instead

橙三吉。 提交于 2019-12-14 02:18:24
问题 I've been looking at examples of ER diagrams to better understand them. I came across an ER diagram that I am not sure is correct. Here is the question/specification: UPS prides itself on having up-to-date information on the processing and current location of each shipped item. To do this, UPS relies on a company-wide information system. Shipped items are the heart of the UPS product tracking information system. Shipped items can be characterized by item number (unique), weight, dimensions,

Referencing the foreign key of another schema

岁酱吖の 提交于 2019-12-14 02:16:44
问题 For my project I am using oracle database where I have to work with 2 different database schema. Consider the following scenario please - I have a schema A and in it I have a table table_a with a primary key apk And I have another schema B and in it I have a table table_b with a primary key bpk If both of these tables are in a same database then I can easily make a primary key - foreign key relationship. But can I make a primary key - foreign key relation ship (or something like this) between

Is handling very large concurrency not possible?

余生颓废 提交于 2019-12-14 01:55:01
问题 Recently I am building a REST api as part of an assignment where I am suppose to increment a counter in the database table, assuming the table has only one column, I am suppose to fire like 1000 requests per second to this REST api to increment the counter and at the end the data should be consistent i.e. if initially the counter value in DB is 0 then after the succesful run of 1000 requests concurrently it should be 1000. No worries so far I achieved it via database row-level locking, other

How to represent a many-to-many relationship in a relational database?

此生再无相见时 提交于 2019-12-13 20:45:47
问题 I have two tables Country and Region. A Region is a set of one or several Countries. Some Countries are in no Region. How should I represent this in a relational database? I thought of the two following possibilities: Country has a Edition column that includes either null or the Edition that it belongs to. My problem with this: I have been taught nulls are evil in a database. Edition has a Countries column that is an array of Country. My problem with this: I have been taught arrays are evil

How would storing XML in a relational database violate Normalization Principles?

白昼怎懂夜的黑 提交于 2019-12-13 16:42:31
问题 In this book: Regina Obe & Leo Hsu , PostgreSQL Up & Running, p. 101. It is written as an introduction to PostgreSQL XML data-type: The XML data type, similar to JSON, is “controversial” in a relational database because it violates principles of normalization. Without further explanation. Could someone detail what is normalization principles and why XML does violate some of those principles. 回答1: There are many tutorials on relational database normalization in books and on the web. See for

Multiple Foreign Keys for the same business rule

天大地大妈咪最大 提交于 2019-12-13 10:24:41
问题 Lets jump to an example that illustrates a table referencing multiple tables : CREATE TABLE Corses ( ID int PRIMARY KEY, ..... ) CREATE TABLE Questions ( ID int PRIMARY KEY, ..... ) CREATE TABLE Answers ( ID int PRIMARY KEY, ..... ) CREATE TABLE Files ( ID INT PRIMARY KEY, Corse_ID INT, Question_ID INT, Answer_ID INT, FOREIGN KEY (Corse_ID) REFERENCES Corses(ID), FOREIGN KEY (Question_ID) REFERENCES Questions(ID), FOREIGN KEY (Answer_ID) REFERENCES Answers(ID) ) The example above illustrates

Must a natural join be on a shared primary key?

戏子无情 提交于 2019-12-13 09:47:14
问题 Suppose I perform A natural join B, where: A's schema is: (aID), where (aID) is a primary key. B's schema is: (aID,bID), where (aID, bID) is a composite primary key. Would performing the natural join work in this case? Or is it necessary for A to have both aID and bID for this to work? 回答1: NATURAL JOIN returns rows with one copy each of the common input table column names and one copy each of the column names that are unique to an input table. It returns a table with all such rows that can