# Is there something wrong with this database?

**URL:** <https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754>\
**Category:** Databases\
**Created:** [September 13, 2024, 10:49am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754 "2024-09-13T10:49:07Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [September 13, 2024, 10:49am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/1 "2024-09-13T10:49:07Z")

</div>

Hiya,

I’m trying to process some data for work. I have converted the data (which was in CSV format) to an SQLite database using Norman Palardy’s tool ([GitHub - npalardy/CSVParser: Event based and recordset like CSV parser for Xojo](https://github.com/npalardy/CSVParser)).

The database has a single table (`Radiologists`) and the full database has about 18,000 rows.

I was just trying a simple SQL statement:

`SELECT * FROM Radiologists WHERE `radID` = 19;`

but I get an SQL error saying that `column radID doesn't exist`. I have definitely spelled it correctly. As far as I can tell there are no weird characters in the column name.

Oddly, if I do an almost identical query but use the `Values` column the query works fine:

`SELECT * FROM Radiologists WHERE `Values` = 6;`

I have attached a massively edited version of the database with only 500 rows that exhibits the same behaviour.

I have tried querying the database both from within Xojo and using a third party tool (`Base` for macOS) and get the same error.

What am I doing wrong?

[Radiologists.sqlite.zip](https://forum.xojo.com/uploads/short-url/wS7hUmP0sBCNgotWQAt4MwjEkLD.zip) (186.5 KB)

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 10:55am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/2 "2024-09-13T10:55:02Z")

</div>

A simple look at your .sqlite file (as.txt) lead to:

 ![image](https://forum.xojo.com/uploads/default/original/3X/3/c/3c3cd443d3f4e9bca5b10529cd02bb1d62afc279.png)

As you can see, there is something strange with the radID column name. I need to fire a specific tool to really watch what happened. I have to search on my SSD for it and come back later.

---

<div class="post-metadata">

**Author:** ![kevin\_g](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kevin\_g](https://forum.xojo.com/u/kevin_g)\
**Post date:** [September 13, 2024, 10:55am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/3 "2024-09-13T10:55:24Z")

</div>

You’ve got some dodgy characters in your Create statement.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 13, 2024, 11:00am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/4 "2024-09-13T11:00:30Z")

</div>

Have you looked at it with the sqlite3 CLI tool? That can do csv import too.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:02am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/5 "2024-09-13T11:02:36Z")

</div>

This looks like that, but a further look denies that:

 ![image](https://forum.xojo.com/uploads/default/original/3X/e/6/e61fcd5a09212d8a3cbbb9f1e120ecc0c5bbcca4.jpeg)

I copied the radID line from the right ListBox (image above) and paste it into TextEdit (macOS): no gremlin in the text. I will add a bread in the code and watch what can be seen in the debugger.

---

<div class="post-metadata">

**Author:** ![GarryPettet](https://forum.xojo.com/user_avatar/forum.xojo.com/garrypettet/32/31_2.png) [@GarryPettet](https://forum.xojo.com/u/GarryPettet)\
**Post date:** [September 13, 2024, 11:03am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/6 "2024-09-13T11:03:22Z")

</div>

How strange. I ported the code from Norm’s repo to modernise it - this is the create table code in the Xojo debugger:

```no-highlight
CREATE TABLE "Radiologists"(
"id" INTEGER PRIMARY KEY,
"﻿radID" INTEGER,
"FRCR" INTEGER,
"Gender" TEXT,
"ReportingYear" INTEGER,
"Age" INTEGER,
"YearsWithMedica" INTEGER,
"Type" TEXT,
"Values" TEXT
);

```

Don’t see any weird characters. Very odd.

I’ll take a look at the SQLite CLI - didn’t even know there was one (DBs are not something I use very often).

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:06am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/7 "2024-09-13T11:06:25Z")

</div>

That’s it:

 ![image](https://forum.xojo.com/uploads/default/original/3X/b/8/b89ae6c13f96923da47b2fbc8a4c7e221cfbdc1e.png)

---

<div class="post-metadata">

**Author:** ![Richard\_Klingler](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_klingler/32/8198_2.png) [@Richard\_Klingler](https://forum.xojo.com/u/Richard_Klingler)\
**Post date:** [September 13, 2024, 11:08am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/8 "2024-09-13T11:08:05Z")

</div>

I use the free version of Beekeeper Studio. Runs on macOS, linux and Windows and supports MySQL, PostgreSQL, SQLite and SQL Server. You can even connect via SSH to a remote database:

> **[The SQL Editor and Database Manager Of Your Dreams](https://www.beekeeperstudio.io)**
>
> Use Beekeeper Studio to query and manage your relational databases, like MySQL, Postgres, SQLite, and SQL Server.

 ![Bildschirmfoto 2024-09-13 um 13.05.57](https://forum.xojo.com/uploads/default/original/3X/d/b/db8769df137180997d04d31af63f4c4eeaa634ec.jpeg)

---

<div class="post-metadata">

**Author:** ![kevin\_g](https://forum.xojo.com/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kevin\_g](https://forum.xojo.com/u/kevin_g)\
**Post date:** [September 13, 2024, 11:08am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/9 "2024-09-13T11:08:05Z")

</div>

I think the dodgy characters are either being stripped out are not visible. Try using the cursor keys to see if the cursor appears to stick when it should move.

If I open the database in SQLite Manager, copy the Create statement and paste it into BBEdit and then do a hex dump I see the following:

```auto
0000: 43 52 45 41 54 45 20 54 41 42 4C 45 20 22 52 61 CREATE TABLE "Ra
0010: 64 69 6F 6C 6F 67 69 73 74 73 22 28 0A 22 69 64 diologists"(¬"id
0020: 22 20 49 4E 54 45 47 45 52 20 50 52 49 4D 41 52 " INTEGER PRIMAR
0030: 59 20 4B 45 59 2C 0A 22 EF BB BF 72 61 64 49 44 Y KEY,¬"ï»¿radID
0040: 22 20 54 45 58 54 2C 0A 22 46 52 43 52 22 20 54 " TEXT,¬"FRCR" T
0050: 45 58 54 2C 0A 22 47 65 6E 64 65 72 22 20 54 45 EXT,¬"Gender" TE
0060: 58 54 2C 0A 22 52 65 70 6F 72 74 69 6E 67 59 65 XT,¬"ReportingYe
0070: 61 72 22 20 54 45 58 54 2C 0A 22 41 67 65 22 20 ar" TEXT,¬"Age" 
0080: 54 45 58 54 2C 0A 22 59 65 61 72 73 57 69 74 68 TEXT,¬"YearsWith
0090: 4D 65 64 69 63 61 22 20 54 45 58 54 2C 0A 22 54 Medica" TEXT,¬"T
00A0: 79 70 65 22 20 54 45 58 54 2C 0A 22 56 61 6C 75 ype" TEXT,¬"Valu
00B0: 65 73 22 20 54 45 58 54 0A 29 es" TEXT¬)

```

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:10am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/10 "2024-09-13T11:10:04Z")

</div>

If you display the create stable statement with UTF8 encoding, you see nothing; but with a Macintosh encoding and Kevin hex too, you can see “garbage” before the Column name.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 13, 2024, 11:11am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/11 "2024-09-13T11:11:32Z")

</div>

It’s not garbage; it’s valid UTF-8 character as follows:

`U+FEFF	﻿	ef bb bf ZERO WIDTH NO-BREAK SPACE`

I think all that @GarryPettet has to do is edit the first line of the CSV file to remove that in the header line, and re-import.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:11am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/12 "2024-09-13T11:11:48Z")

</div>

> [@Richard\_Klingler](#):
>
> [https://www.beekeeperstudio.io](https://www.beekeeperstudio.io)

Display nothing because it uses UTF8 as the encoding.

---

<div class="post-metadata">

**Author:** ![Richard\_Klingler](https://forum.xojo.com/user_avatar/forum.xojo.com/richard_klingler/32/8198_2.png) [@Richard\_Klingler](https://forum.xojo.com/u/Richard_Klingler)\
**Post date:** [September 13, 2024, 11:13am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/13 "2024-09-13T11:13:23Z")

</div>

Did I say it should display it? 😉  
I just mentioned it as a free database tool (o;

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:15am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/14 "2024-09-13T11:15:00Z")

</div>

> [@TimStreater](#):
>
> It’s not garbage

Don’t you see the quotes around “garbage” ?

In the context, it can be considered as garbage (or call it gremlin). It have nothing to be removed. But removing something you cannot see is hard.

---

<div class="post-metadata">

**Author:** ![Emile\_Schwarz](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/90ced4/32.png) [@Emile\_Schwarz](https://forum.xojo.com/u/Emile_Schwarz)\
**Post date:** [September 13, 2024, 11:16am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/15 "2024-09-13T11:16:38Z")

</div>

It was invisible too in my software tool. I only explained why we see nothing where there is something to watch.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 13, 2024, 11:17am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/16 "2024-09-13T11:17:42Z")

</div>

@GarryPettet can open the CSV file with a text editor, and remove not just radID in the header, but chars to the left and right of that, and then carefully enter those characters back. That way, the characters deleted will contain the NO-BREAK-SPACE.

Job done.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [September 13, 2024, 11:27am UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/17 "2024-09-13T11:27:38Z")

</div>

Emile is correct.

There’s invisible garbage inserted. Clean it up and everything will work as it should be.

---

<div class="post-metadata">

**Author:** ![Maximilian\_Tyrtania1](https://forum.xojo.com/user_avatar/forum.xojo.com/maximilian_tyrtania1/32/16871_2.png) [@Maximilian\_Tyrtania1](https://forum.xojo.com/u/Maximilian_Tyrtania1)\
**Post date:** [September 13, 2024, 12:27pm UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/18 "2024-09-13T12:27:29Z")

</div>

Try this:  
SELECT \* FROM “Radiologists” WHERE radID = 19;

This would work if the table “Radiologists” has been created with the quotes (which means “hey, i am dead serious about the capitalization”).

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [September 13, 2024, 12:31pm UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/19 "2024-09-13T12:31:23Z")

</div>

> [@Maximilian\_Tyrtania1](#):
>
> Try this

Not the case. Emile found the problem. Probably came from some copy/paste content. Easy fix.

---

<div class="post-metadata">

**Author:** ![TimStreater](https://forum.xojo.com/user_avatar/forum.xojo.com/timstreater/32/586_2.png) [@TimStreater](https://forum.xojo.com/u/TimStreater)\
**Post date:** [September 13, 2024, 12:33pm UTC](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754/20 "2024-09-13T12:33:52Z")

</div>

That’s not where the problem lies, though. The original CSV file from which the Radiologists table and its columns was created, has a UTF-8 non-breaking space as the first char of the radID column name in the header line of the CSV file. This can be removed by editing and the database recreated.

[Next page](https://forum.xojo.com/t/is-there-something-wrong-with-this-database/81754.md?page=2)
