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 835993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T04:54:40+00:00 2026-05-15T04:54:40+00:00

SQL noob, please bear with me!! I am storing a 3-tuple in a database

  • 0

SQL noob, please bear with me!!

I am storing a 3-tuple in a database (x,y, {signal1, signal2,..}).
I have a database with tables coordinates (x,y) and another table called signals (signal, coordinate_id, group) which stores the individual signal values. There can be several signals at the same coordinate.

The group is just an abitrary integer which marks the entries in the signal table as belonging to the same set (provided they belong to the same coordinate). So that any signals with the same ‘coordinate_id’ and ‘group’ together form a tuple as shown above.

For example,

Coordinates table                 Signals table
--------------------             -----------------------------     
| id  |  x  |  y  |              | id | signal | coordinate_id | group | 
|  1  |  1  |  2  |              | 1  |   45   |       1       |   1   |
|  2  |  2  |  5  |              | 2  |   95   |       1       |   1   |
                                 | 3  |   33   |       1       |   1   |
                                 | 4  |   65   |       1       |   2   |
                                 | 5  |   57   |       1       |   2   |
                                 | 6  |   63   |       2       |   1   |

This would produce the tuples (1,2 {45,95,33}), (1,2,{65,57}), (2,5, {63}) and so on.

I would like to retrieve the sets of {signal1, signal2,…} for each coordinate. The signals belonging to a set have the same coordinate_id and group, but I do not necessarily know the group value. I only know that if the group value is the same for a particular coordinate_id, then all those with that group form one set.

I tried looking into SQL GROUP BY, but I realized that it is for use with aggregate functions.

Can someone point out how to do this properly in SQL or give tips for improving my database structure.

  • 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-05-15T04:54:41+00:00Added an answer on May 15, 2026 at 4:54 am

    SQLite supports the GROUP_CONCAT() aggregate function similar to MySQL. It rolls up a set of values in the group and concatenates them together comma-separated.

    SELECT c.x, c.y, GROUP_CONCAT(s.signal) AS signal_list
    FROM Signals s
    JOIN Coordinates ON s.coordinate_id = c.id
    GROUP BY s.coordinate_id, s.group
    

    SQLite also permits the mismatch between columns in the select-list and columns in the group-by clause, even though this isn’t strictly permitted by ANSI SQL and most implementations.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 523k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Please comment the "PRINT @ErrorString;" statement. When SQL Engine throws… May 16, 2026 at 9:42 pm
  • Editorial Team
    Editorial Team added an answer I have to compare the values to find which ones… May 16, 2026 at 9:42 pm
  • Editorial Team
    Editorial Team added an answer If what you want to do is output some content… May 16, 2026 at 9:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am a bit of an sql noob so please forgive. I can't seem
Please forgive me as I am a bit of an sql noob. I am
I'm a sql noob trying to get this query to use 2 tables. tables
Sorry, I am pretty much an SQL noob. This has to work in MSFT
Pardon me, this really is a noob question but please understand that I do
I have a messy stored procedure which uses dynamic sql. I can debug it
Complete sql noob here. Trying to think about a way to store some data
I'm a SQL noob, and I need a little bit of help understanding the
Note that I'm a complete SQL noob and in the process of learning. Based
SQL Server 2000 I backup a table like below: select * into bkp_table from

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.