Home >

relational division

Advertisement
  • Select badges from table only if all requirements rows existFebruary 8

    I got three tables. I want to query the badges table to get the badge if all the missions exists for the badge_id in the badge_requirements table. In the case below, the badge would be returned because for badge_id = 1, all missions exist. But if, fo

  • Prove or disprove that `T=R÷S` implies `S=R÷T`? [on hold]February 7

    Prove or disprove: Given that T=R÷S, it is implied that S=R÷T. My attempt: Let us take some R,S tables and we will divide R÷S: step 1: R S ==> T=R÷S ------------- --------- ----- | A | B | C | | A | B | | C | | 1 | 2 | 4 | | 1 | 2 | | 4 | | 3 | 3 | 4

  • Writing a specific query in SQliteJanuary 22

    consider the following schemes employee (id, fname, lname) department (dept_no, dept_name) project(proj_no, proj_name, dept_no) works_on(emp_id, proj_no, hours) the keys are in bold. I need to find all employees (their names) that are taking part in

  • Finding parent by set of childrenDecember 23

    Given a many-to-many relationship (product/component), I need to find a product (or all products) that are composed from the given set of components. I can't wrap my head around the SQL query for this. A general solution, but if there is anything par

  • How to deduplicate SELECT statements in relational division?August 17

    I have a query that does a lot of duplicate work: SELECT visitor_id, '1'::text AS filter FROM events WHERE id IN (SELECT event_id FROM params WHERE key = 'utm_campaign' AND value = 'campaign_one') AND id IN (SELECT event_id FROM params WHERE key = 'u

  • Finding two users with same pair groupJuly 27

    I have the following table which details actions of users and the action's parameters: action_id(auto-increment) | user_id | action_name | action_attr1 I want to find which users performed the same actions exactly with same action_attr1. Meaning, I w

  • Querying on multiple joined rowsJune 17

    I have a table called visits that is structured like so: +----+--------------+-------------+ | id | name | visitor_id | |----+--------------+-------------+ | 1 | event1 | 1 | | 2 | event2 | 2 | +----+--------------+-------------+ I have a table calle

  • Matching a value with every element of a set of values - PostgresqlNovember 7

    I'm new in Postgres and I can't achieve what I'm trying to do. I have a list of films in a Films table ID_FILM FILM NAME 1 Terminator 2 Forrest Gump 3 Nueve reinas A Country table ID_COUNTRY COUNTRY 1 ARGENTINA 2 ENGLAND 3 USA 4 FRANCE Finally, I hav

  • Find all users who rated all the movies rated by a specific userSeptember 30

    So we have the following relational schema: users(user_id, ..) movies(movie_id, ..) ratings(user_id, movie_id, rate) So, we want to find all the users who have rated all the movies which are rated by a specific user '1234' In other words, if user '12

  • Active record relation AND filtering August 22

    I've asked the same question on stackoverlow, but got no answer, so that's why I'm asking it here (I've read that simple sql questions should be asked at SO, but I have no choice). Suppose I have 3 tables: posts, post_categories and categories. I'm i

  • Make IN clause behave like AND clauseAugust 22

    I've asked the same question on stackoverlow, but got no answer, so that's why I'm asking it here (I've read that simple sql questions should be asked at SO, but I have no choice). Suppose I have 3 tables: posts, post_categories and categories. I'm i

  • What Happens when Cartesian Product is applied to Relations with same attribute name

    What Happens when Cartesian Product is applied to Relations with same attribute nameFebruary 8

    I understand that the Cartesian product(X) operation on two databases does not need to be UNION compatible.So,if there is a same attribute called name in the two relations R and S where name in R is the first name and name in S is the second name How

  • Joining and filtering two sets of the same tableNovember 25

    I guess this is an easy and stupid question. Consider this MySQL purchase table (where p_id is autoincremented): +---------+-------------+---------------+---------+ | p_id | item_id | user_id | count | ... +---------+-------------+---------------+---

  • How to find parent rows that have indentical sets of child rows?June 26

    Suppose I have structure like this: Recipes Table: RecipeID Name Description RecipeIngredients Table: RecipeID IngredientID Quantity UOM What are some good ways for finding duplicate recipes? A duplicate recipe is defined as having the exact same set

  • How to represent class table inheritance (current DBMS-specific way please)?March 24

    I want to implement class either-or table inheritance (Account, CatAccountDetails, DogAccountDetails) in SQL Server. I found a recommendation for MySQL here (How do I map an IS-A relationship into a database?). Basically, it is: use identical primary

  • Many-to-one Subselection in single queryNovember 9

    I have two tables with a foreign key from T1->T2, in a one-to-many relationship. That is, 1 tuple in table T1 is associated with 0..N tuples in T2. To create a simple example, lets say T1 is Cars, and T2 is a table of imperfections. So, a car can hav

  • Help with Query. Finding records that have the same relationships (MySQL)March 5

    I have a table of Listings that has a many to many relationship with a Taxons table. The table structure looks like this: listings ---------------- id (int) name (varchar) listings_taxons ---------------- listing_id (int) taxon_id (int) taxons ------

Copyright (C) 2017 ceus-now.com, All Rights Reserved. webmaster#ceus-now.com 14 q. 0.436 s.