Why aren't my functions working as expected in MySQL? - mysql

I am trying to figure out why MYSQL isn't working as expected.
I imported my data from a CSV into a table called Products, which is shown in the screenshot. It's a small table of just ID and Name.
But when I run the where clause, finding out where the Name = 'SMS', it returns nothing? I don't understand what the issue is.
My CSV contents in Notepad++ is shown below:
This is what I used to load in my CSV, if there are any errors here.

Could you share your csv file content?
It's happened to me too before, and the problem is because there's some blank space in the data in csv file.
So maybe you could parse first your csv file data (remove the "not needed" blank space) before import it to database

This is often caused by spaces or look-alike characters. If caused by spaces or invisible characters at the beginning/end, you can try:
where name like '%SMS%'
You can then make this more general:
where name like '%S%M%S%'
When you get a match, you'll need to do more investigate to find the actual cause.

Related

Jmeter adds extra characters  when reading from a csv

I'm reading some values from a csv like this:
But I'm getting some strange extra characters at the beginning of the ID value like this:
The CSV file is just an id, a name and line breaks. Why do I get these other characters?
The specific characters you see ( or EF BB BF in hex) are Byte order mark for UTF-8. So it is coming from your CSV file, likely somehow added on saving the file. So try to set File encoding parameter to UTF-8, it should help.
In my case I have selected UTF-8 as encoding, It worked fine for few parameters, but I still observed  before one parameter i.e URL.
CSV used: url,id,token
Url looks like: abc.def.ghi.jkl.com
Id looks like: jhas880ad
token is JWT token
I observed following exception in jMeter response:
java.net.UnknownHostException: ?abc.def.ghi.jkl.com
at java.net.InetAddress.getAllByName0(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at java.net.InetAddress.getAllByName(Unknown Source)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at
Then after a long research, following solution worked for me:
Jmeter put  as prefix for the value of 1st variable taken from CSV file
Thus I used one dummy entry in beginning of csv file and wrote dummy variable name in jMeter csv data set config
click to view image
Updated CSV looked like: dummy,url,id,token
This solution might not be practical for huge data but if you have very few records then you can consider this.
Also, if someone is aware of another workaround, feel free to post.
If you are exporting a ResultSet from DBeaver to a CSV, once you get to the "Output" tab, make sure to select "UTF-8" in the "Encoding" list AND to uncheck the "Insert BOM" box. That worked for me.

Error code: Inavlid in Loading Data on BigQuery

I have a large CSV file (nearly 10,000 rows) and I am trying to upload it on the BigQuery but it gives me this error:
ile-00000000: CSV table references column position 8, but line starting at position:622 contains only 8 columns. (error code: invalid)
Can anyone please tell me a possible to reason to it? I have double checked my Schema and it looks alright.
Thanks
I had this same issue when trying to import a large data set in a csv to a BigQuery table.
The issue turned out to be some ascii control characters (\b, \t, \r, \n) in the data that was written in the csv. When the csv was being sent to BigQuery these characters caused the BiqQuery csv parser to misinterpret the line and break because the data didn't match with the number of columns in the header.
Replacing these characters with a space (to preserve formatting as best as possible) allowed me to import the data without further issues.
The error message suggests that the load job failed because at least one row has fewer columns than the automatically detected schema dictates.
Add
allow_jagged_rows=true
in the options.

Getting Invalid column count in CSV input on line 1 error

I'm trying to export a CSV from my client's FluidSurvey's account and import it into a database I've created. I've never actually worked with a CSV before, so excuse my ignorance.
I've looked into this error and none of the solutions seem to be working for me, I'm at a loss, I've been trying to import this file for hours now.
Settings are as follows:
There is already a table with columns for this data to be inserted into.
What am I missing here?
You've showed exported csv file in Excel or Calc. It is impossible to understand how you columns are enclosed. Probably there is some sign other than ' or " Please show exported csv in notepad. This will clear the structure of csv.
I found that Fluidsurveys CSV files had the header two bytes incorrect.
They are only 7F7E. Changing them to the expected Unicode FFFE works as expected - they can be read into Excel with no garbage characters at the start.

How to Convert a Comma-Separated File to Pipe-Delimited File in Powershell?

I am downloading CSV files which are comma-separated. The problem i'm having is that the commas are screwing-up my import into a database table (SQL Server). For example, I have a header row called hotel_name, but some of the names are like the following:
HOTEL_NAME
hilton
cambridge,the
The problem is that fields containing a comma in the hotel name will move to the adjacent column, like this I'm wondering if converting from CSV to a pipe-delimited format will work.
The problem i'm having is that i'm not sure how to get started. I've tried following the Powershell documentation but get basic errors. I think this is because i'm new to Powershell and not understanding something. Can someone please post a script of how to change the comma-separated file to a pipe-delimited file?
Sorry if this is confusing, i'm finding the formatting on StackOverflow to be a bit crazy.
Taken from Dealing with commas in a CSV file
Use " to wrap data that contains a comma.
For example
Server000,"Microsoft(R) Windows(R) Server 2003, Enterprise Edition"

Cannot import csv into mysql database using phpmyadmin wizard

I am trying to import a csv file into my mysql database using phpmyadmin but keep getting errors.
Here is how the csv looks:
Then I import like this:
And get the error: "Invalid parameter for CSV import: Fields enclosed by". I have tried to put the columns in quotes " or put a semicolon after each column, but keep getting errors.
Yeah, you have an extra field in there. For instance, with your example line of:
itemId,date,description,amount
,1,2/13/2013,Fabrics,44
the date maps to "description" because of the leading comma, which basically gives an empty (or null, depending on how the import is handled) value to itemId, which doesn't seem to be what you want. Where'd that extra comma come from -- was this an export from some program?
Also, in this case you don't have anything enclosing the fields so you should just be able to leave that value empty, which seems to have worked for you once you got the column count corrected.
I had to remove the first line of the csv (containing the column names) and that solved the issue. Everything got imported properly.
Note, the date field needed reformatting to match SQL's date format yyyy-mm-dd.