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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:39:02+00:00 2026-05-25T15:39:02+00:00

I have a table in my database in SQLITE which has x and y

  • 0

I have a table in my database in SQLITE which has x and y co-ordinates in location field as (10,10).
I want to use the x co-ordinate and y co-ordinate separately by using a select query. I know we can use subtr and charAtIndex to locate the position but I am not sure how to do it ?
I am new to sqlite and need some help to sort this out.

  • 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-25T15:39:04+00:00Added an answer on May 25, 2026 at 3:39 pm

    SQLite’s string functions are fairly limited but you abuse its implicit type conversions to split your string. Something like this should do it:

    select xy + 0 as x,
           substr(xy, length(xy + 0) + 2) as y
    from some_table
    

    That should work as long as you don’t have any leading zeros or spaces or internal spaces. Adding zero turns the value into a number so '10,5' + 0 becomes just 10; then calling length on that turns it back into a string and gives you the string length, then adjust that to account for the comma (+1) and length-to-offset (+1) change and you’ll get your 5 out of '10,5'.

    For example:

    sqlite> select '10,5' + 0 as x, substr('10,5', length('10,5' + 0) + 2) as y;
    x|y
    10|5
    

    That said, you really should redesign your schema to have separate columns for the X and Y coordinates, storing structured data inside a single column is generally a bad idea.


    Update for comments: SQLite will also let you do things like this:

    select value,
           xy + 0 as x,
           substr(xy, length(xy + 0) + 2) as y
    from some_table
    where x < 2000
      and y < 2000
    

    or even:

    select value
    from some_table
    where (xy + 0) < 2000
      and substr(xy, length(xy + 0) + 2) < 2000
    

    These sorts of queries will end up doing full table scans though so they might be too slow for you. Fixing your schema to have separate X and Y coordinate columns OTOH would give you fast queries.

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

Sidebar

Related Questions

I have a DataTable which I want to save to a SQLite Database Table.
I have one sqlite database which has one table in which I store the
I have a text field in SQLite database, which I want the user to
I have one problem with Android SQLite database. I have one table which contains
I have a SQLite database, which needs to be updated. Using the update statement
I have a database table with a field that has values such as AAAA
I have a SQLITE database with two tables. Table A has an integer timestamp
In my app I have SQLite database that has one table with date rows
I have a pre-established SQLite Database in my application. It has a table with
I have a table in database that is having some fields one of which

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.