Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

MySQL returning empty set with data in the table

 
Ranch Hand
Posts: 42
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good morning everyone!

I am taking an intro to database class, which is also an intro to SQL

I have encountered an issue where I imported a csv file (they provided it) and I can successfully execute my queries unless the WHERE clause has a specific column name (Reason).
I have reached out to my instructor, but his turn around time on replies is often not until the next day. I have been searching for a fix, but so far have been unsuccessful.
I will try to duplicate my code below, The screenshot shows a description of the table as well as an example of the data that I imported.


This is what I cannot get to work. It returns an empty set.

I have even tried...

The result is an empty set!

My instructor suggested that I may have an unexpected carriage return at the end, so he suggested I try LIKE instead of =

This also returned an empty set.

If I enter any other column (RMAID, OrderID, Step,  or Status) in the WHERE clause everything works fine.
I can search for specific strings or integers as needed and get a proper return.

This is the code I used to import the csv file...
I have also tried it without the IGNORE statement with the same results

The nature of the assignment doesn't call for any scripting, as this is basic stuff. I have done a small amount of scripting with python, java, and Linux, but
I am by no means proficient at it.

Thanks

Exco
screenshot-Ranch.jpg
[Thumbnail for screenshot-Ranch.jpg]
 
Marshal
Posts: 25795
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try


and see what you get.
 
Saloon Keeper
Posts: 22480
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If that was a DOS file, lines would actually be terminated by "\r\n", not "\n" like Linux/MacOS. And the lack of a bar on the righthand side of your data display hints at that.

Check the MySQL docs to see what they have for that situation.
 
Bill Platt
Ranch Hand
Posts: 42
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone!

The short answer is that I'm an idiot. I had the wrong search string in my WHERE statement.

I was using 'Restricted%' instead of 'Rejected%'

Sorry it took so long to get back, I've been working crazy hours lately.

Bill
 
Paul Clapham
Marshal
Posts: 25795
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bill Platt wrote:The short answer is that I'm an idiot. I had the wrong search string in my WHERE statement.



And worse, you posted the right search string here! Oh well... it's fixed now, all's well that ends well.
 
Tim Holloway
Saloon Keeper
Posts: 22480
151
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually that's a dirty load. End-of-line characters have no business in your database. They not only make searching a mess, they're a wasted (albeit a small one) of space.

Load with: --lines-terminated-by="\r\n"
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic