Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8912847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:18:47+00:00 2026-06-15T04:18:47+00:00

Data: table shapes : shape_id, shape_name table shape_forms : shape_form_id, shape_id, shape_form shape_form can

  • 0

Data:

  1. table shapes: shape_id, shape_name
  2. table shape_forms: shape_form_id, shape_id, shape_form
  3. shape_form can be: 0 – circle, 1 – square, 2 – triangle – the number of which for each shape is unlimited

I need 2 queries for selecting

  1. all shapes which contains in shape_forms both circles and triangles or only circles but not squares or only triangles
  2. all shapes which contains in shape_forms only triangles

Please, give me some hints for solving this task!
I’m restricted not to use “group by” for shape_forms but if there is no proper solution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:18:49+00:00Added an answer on June 15, 2026 at 4:18 am

    1.

    select s.shape_id
    from shapes s
    inner join shape_forms sf on sf.shape_id = s.shape_id
    group by s.shape_id
    having 
    (
       sum(shape_form = 1) = 0
       and sum(shape_form in (0,2)) >= 2
    )
    or sum(shape_form <> 0) = 0
    

    2.

    select s.shape_id
    from shapes s
    inner join shape_forms sf on sf.shape_id = s.shape_id
    group by s.shape_id
    having sum(shape_form <> 2) = 0
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data table with many rows and columns. How can I display
I have a data table which already has some values, plus it is getting
I have created a table umriss which I filled with data and I still
data table contain column named as Fld_primary. this column contain value like 0.00 it
The data.table package is very helpful in terms of speed. But I am having
The data.table package provides many of the same table handling methods as SQL. If
I have a sample data table(id, name, date_create) table(1, 'Iphone 4S', '2012-06-18 17:19:05') //
I have a JSF data table <h:dataTable id=memberTable value=#{bean.pList} border=0 rowClasses=rowEven rowOdd var=item> <h:column
I have a data.table object like this one library(data.table) a <- structure(list(PERMNO = c(10006L,
I have the data table from the jquery plugin dataTables (http://datatables.net/) that I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.