relational-division Questions
6
Solved
I have the following example data structure of customer that can be part of multiple groups using a junction table and data:
CREATE TABLE customer(id) AS VALUES (0),(1),(2),(3);
CREATE TABLE groups...
Dorree asked 7/8 at 9:39
3
Solved
I'm using PostgreSQL 9.4 with a table teams containing a jsonb column named json. I am looking for a query where I can get all teams which have the Players 3, 4 and 7 in their array of players.
T...
Bibb asked 17/3, 2015 at 19:37
12
Solved
Ok, I think I might be overlooking something obvious/simple here... but I need to write a query that returns only records that match multiple criteria on the same column...
My table is a very simp...
Wounded asked 28/10, 2010 at 21:57
4
Table: articles
+--------+------+------------+
| id | title| created |
+--------+------+------------+
| 201 | AAA | 1482561011 |
| 202 | BBB | 1482561099 |
| 203 | CCC | 1482562188 |
+--------+---...
Hypochondria asked 24/12, 2016 at 7:11
9
What is the easiest and fastest way to achieve a clause where all elements in an array must be matched - not only one when using IN? After all it should behave like mongodb's $all.
Thinking about ...
Sugarplum asked 13/7, 2012 at 10:21
9
Solved
I'm following the Stanford Database course and there's a question where we have Find all pizzerias that serve every pizza eaten by people over 30 using Relational Algebra only.
The problem consist...
Lachellelaches asked 19/10, 2011 at 13:1
3
Solved
Assume I have two tables:
cars – list of cars
carname | modelnumber | ...
passedtest – contains every test that a car passed:
id | carname | testtype | date | ...
1 | carA | A | 2000 |
2 | car...
Linguiform asked 12/4, 2013 at 17:8
9
I have the following tables:
work_units - self explanatory
workers - self explanatory
skills - every work unit requires a number of skills if you want to work on it. Every worker is proficient in...
Reactor asked 22/11, 2017 at 17:38
8
I have a following table structure.
USERS
PROPERTY_VALUE
PROPERTY_NAME
USER_PROPERTY_MAP
I am trying to retrieve user/s from the users table who have matching properties in property_value table...
Greer asked 17/11, 2017 at 13:28
5
Solved
Let's suppose I have a table T1 with people IDs and other stuff IDs, as the following
Table: T1
personID | stuffID
1 | 1
1 | 2
1 | 3
1 | 4
2 | 1
2 | 4
3 | 1
3 | 2
And another table T2 w...
Darondarooge asked 9/3, 2015 at 10:8
2
Solved
I am trying to optimize my SQL query, so that we will not have to process the response on our JVM.
Consider we have following table with entries:
+-----------+-------------+
| Column1 | Column2 |...
Leaf asked 30/6, 2017 at 9:34
2
Solved
The association is as shown below.
InstructorStudent has_many :fees
Fee belongs_to :instructor_student
I want to get the instructor student who has monthly detail in all given array. If monthly...
Inextirpable asked 29/6, 2017 at 5:8
13
Solved
Assuming I have the tables student, club, and student_club:
student {
id
name
}
club {
id
name
}
student_club {
student_id
club_id
}
I want to know how to find all students in both the soc...
Justificatory asked 9/9, 2011 at 16:54
4
Solved
I want to find the distinct pairs of names in the table which have the same exact items in the items column. For instance:
CREATE TABLE t
(
name VARCHAR(255),
item VARCHAR(255)
);
INSERT INTO t...
Crossindex asked 4/11, 2015 at 4:49
3
Solved
I want to find the borrowers who took all loan types.
Schema:
loan (number (PKEY), type, min_rating)
borrower (cust (PKEY), no (PKEY))
Sample tables:
number | type | min_rating
-------------...
Valise asked 16/10, 2015 at 17:45
4
Solved
I have a PostgreSQL database that stores users in a users table and conversations they take part in a conversation table. Since each user can take part in multiple conversations and each conversati...
Elam asked 4/1, 2015 at 1:41
1
Solved
I have a list of 365 customers. Each of them has a potentially unique list of products they are allowed to order, up to 18 out of 24 total products (at present). I would like to use groups to assig...
Antependium asked 15/8, 2014 at 21:22
9
Solved
Pardon the title, I've no clue what to call this.
So imagine I have this
table_ref
id_x|id_y
---------
6|70
6|71
6|72
6|73
8|70
8|73
9|72
9|73
How can i select id_y only if it matches id_x= 6 ...
Borehole asked 1/4, 2014 at 8:39
1
Solved
I am having difficulties to solve one exercise:
For which People there is a Restaurant, that serves ALL their favorite beers.
(Yes, we actually have this in school :D)
I have got 2 Tables that c...
Westmorland asked 30/11, 2013 at 16:23
1
Solved
I am currently stuck in a situation. The scenario is this. I have products who may be associated with multiple categories. The data structure is shown below:
Products Table:
product_id name
1 Lem...
Nothing asked 15/7, 2013 at 19:49
2
Solved
I have table Tasks(employee_name, task)
------------------
Joe | taskA
Joe | taskB
Ted | taskA
Jim | taskB
Ray | taskA
Ray | taskB
John| taskA
Tim | taskC
I need to find all pairs of employees tha...
Fant asked 11/7, 2013 at 19:31
2
SELECT c.name
FROM Customer c
WHERE NOT EXISTS(SELECT w.WID
FROM Woker w
WHERE NOT EXISTS(SELECT la
FROM look_after la
WHERE la.CID = c.CID
AND la.WID = w.WID));
I dont know what the code m...
Sheeran asked 30/6, 2013 at 15:46
1
Solved
I am giving a very abstract version of my question here, so please bear with me. I have a query that will check whether a particular body has certain multiple parameters of same type. Example, a bo...
Subdue asked 9/5, 2013 at 12:23
2
Solved
There is pretty good article how to filter results in a has-many relation:
How to filter SQL results in a has-many-through relation
I'm just seeking a solution for COUNT result, not show them all....
Serialize asked 13/3, 2013 at 10:40
2
For setting consolidated account handling, I want to find out accounts that
have "exactly the same" set of owners.
I think it might work to pivot the owners with dynamic sql, then use
ranking func...
Ordeal asked 10/4, 2012 at 19:8
1 Next >
© 2022 - 2024 — McMap. All rights reserved.