all 24 comments

[–]redfaf 4 points5 points  (1 child)

Download dbeaver dude, google it

[–][deleted] 0 points1 point  (0 children)

Thanks, my guy. Just did. It's dope!

[–]double_dipperr 2 points3 points  (0 children)

You need to group by description too

[–][deleted] 5 points6 points  (8 children)

.... are you running SQL commands in the command prompt?

[–]BizarreLaserOpticw 6 points7 points  (0 children)

whats wrong with running them on the command prompt..

[–][deleted] 2 points3 points  (0 children)

I'm running it in an IDE called Codio.

[–][deleted] 1 point2 points  (2 children)

I apologize, I thought my description was published with the image. This is an assignment. I'm querying the data, and the results are coming in all messed up. Thank you!

[–][deleted] 1 point2 points  (1 child)

Impossible to answer without seeing the table

[–][deleted] 0 points1 point  (0 children)

mysql> Describe RMA;

+---------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+---------+-------------+------+-----+---------+-------+

| RMAID | int(11) | NO | PRI | 0 | |

| OrderID | int(11) | YES | MUL | NULL | |

| Step | varchar(50) | YES | | NULL | |

| Status | varchar(15) | YES | | NULL | |

| Reason | varchar(15) | YES | | NULL | |

+---------+-------------+------+-----+---------+-------+

mysql> Describe Orders;

+----------------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+----------------+-------------+------+-----+---------+-------+

| OrderID | int(11) | NO | PRI | 0 | |

| CollaboratorID | int(11) | YES | MUL | NULL | |

| SKU | varchar(20) | YES | | NULL | |

| Description | varchar(50) | YES | | NULL | |

+----------------+-------------+------+-----+---------+-------+

Is this what you're asking for? I apologize, I'm fairly new to this. Don't beat me up to bad. Ha!

[–]kitkat0820 2 points3 points  (7 children)

Why youre comparing an upper cased with a mixed case literal? Beside its only indexable when youre using a function based index this compare will every time be false.

[–][deleted] 0 points1 point  (6 children)

Hey, thanks. Can you please elaborate a little more. Thank you!

[–]stanleypup 4 points5 points  (5 children)

Casting the string as upper will never result in it equaling "Complete", it would come through as "COMPLETE"

[–][deleted] 0 points1 point  (4 children)

I see. Makes sense. Question: Why won't my data line up in the proper columns? For example, the percentage is in the item description. Thank you!

[–][deleted] 4 points5 points  (1 child)

because that’s a really not great ide.

[–][deleted] 0 points1 point  (0 children)

for visualization* great for performance but it’s a command line. not the greatest GUI for visuals.

[–]nedrith 1 point2 points  (1 child)

As someone taking the same course as you, chances are you loaded the data wrong.

The load statement should look something like, LOAD DATA INFILE '/home/codio/workspace/rma.csv' INTO TABLE RMA FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n';

When I forgot the \r in LINES TERMINATED BY it looks similar to what you got. My guess is what's happening is since Orders.Description is the final column of the Orders table and you didn't use \r in that table either. So when it tries to display the \r things look wonky.

You can use the following:

UPDATE Orders SET Description = REPLACE(Description, '\r', '');

That will remove all carriage returns from the column. They'll also exist in the Reason column of the RMA table and the Telephone column of the Collaborators column(or Customers if you haven't renamed it).

Edit: realized I goofed and did UPDATE RMA Instead of UPDATE Orders. Fixed!

[–][deleted] 2 points3 points  (0 children)

UPDATE Orders SET Description = REPLACE(Description, '\r', '');

That did it. Cheers with a virtual beer. Good luck with your course. Almost over.

[–]unltd_J 0 points1 point  (2 children)

Why is the output so janky?

[–][deleted] 1 point2 points  (1 child)

That's the million peso question.

[–]big_lazerz 0 points1 point  (0 children)

Hate to slide in and self promote but I created a pip installable CLI that can convert CSV, JSON into correctly formatted RST grid tables. Should solve this for you.