I am trying to write an complex mySQL query in which there are 2 tables action and revenue what I need is: From auction table take out location, postal code on the basis of user, cat_id, cat and spent and join with revenue table which has revenue column so as that given cat_id, cat and date I can figure out
Tag: relational-database
Hive QL Declaration
What is the difference between CHAR() and VARCHAR() declarations from HQL?
How to select from table A only where a relationship between the table A row and a specific row in B exists? [closed]
Closed. This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago. Improve this question lets say I have two MySQL tables, table A and table B. Each table has a primary key called id
How to to create a new identifier in SQL for related addresses that have multiple relationships?
I have a data set like below that includes address and customer_id. In this example multiple customers can ship to the same address and a customer can ship to multiple addresses. I would like to use the relationships between these to create a new ID that joins all of the related addresses and customer_id’s with a new identifier. Original Table
how to disallow custom lists to have elements from different base lists
I have the following model: BASE_LIST: in this table we store base lists. Base list can be for example the list of cities in a continent, types of automobiles in a shop etc. ELEMENT: in this table we store the elements of base lists. For example the cities and the car types are here (Budapest, London, Paris, Opel, Bmw, Audi)
Is there any pros to not using Many-to-Many relationship [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. Improve this question I have been asked to create a small program for assignment based on given instructions. I was given two tables I
Sql Query to obtain unique values from a mixed data
I am new to MySql and have been trying to learn it for a project. I have a table as below (Table 1) and I need the output from it as Table 2. The output is ordered by CREATED_AT field and if there are multiple rows for the same FRUIT_TYPE, the field with the least CREATED_AT value is picked. For
How to insert a query calculation into a column/attribute of an already existing entity?
So I had created a query which was used to calculate sales staff commission this gave me the expected result which I needed , so the next thing i needed to do was to insert these calculated values …
Relational Database Question: Parent that references child
Is it valid to have a parent table have a reference to a child table? For example, a table Parents has a child table Children. Children has a foreign key Parent_ID linking back to its parent. But Parent has another column (say favorite_child_id) that is a foreign key back to the Child table. Is this acceptable or is it bad
sqlite select hard coded text given a matching “or” condition
I have a table like this: I am querying for column values whose length is 0 using a statement like this: SELECT key FROM table WHERE length(c1) = 0 OR length(c2) = 0 OR … OR length(cn) = 0; I’d like to have a text associated with the key indicating which condition lead to the match. so something like not