When I run a Select * query for my table the values in the OrderID do not show up. I suspect this has something to do with the Description column which is the last column in my table. When I omit that column the values in OrderID appear. I did need to update the VARCHAR from 50 to 100 characters because I received a truncated error message when importing a csv file into the database. I'm including the syntax for review.
describe Orders;
+-------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+-------------+------+-----+---------+-------+
| OrderID | int(11) | NO | PRI | NULL | |
| CustomerID | int(11) | YES | MUL | NULL | |
| SKU | varchar(20) | YES | | NULL | |
| Description | varchar(50) | YES | | NULL | |
mysql> select * from Orders limit 50;
+---------+------------+------------+----------------------------------------------------+
| OrderID | CustomerID | SKU | Description |
+---------+------------+------------+----------------------------------------------------+
| 76368 | BAS-08-1 C | Basic Switch 10/100/1000 BaseT 8 port
| 62494 | BAS-48-1 C | Basic Switch 10/100/1000 BaseT 48 port
| 98077 | ENT-48-10F | Enterprise Switch 10GigE SFP+ 48 port
| 85882 | ENT-48-40F | Enterprise Switch 40GigE SFP+ 48 port
| 59384 | BAS-48-1 C | Basic Switch 10/100/1000 BaseT 48 port
| 96361 | ENT-48-10F | Enterprise Switch 10GigE SFP+ 48 port
| 15 | 67424 | ADV-48-10F | Advanced Switch 10 GigE Copper/Fiber 44 port coppe |
| 93634 | ENT-24-10F | Enterprise Switch 10GigE SFP+ 24 Port
| 62756 | ENT-24-40F | Enterprise Switch 40GigE SFP+ 24 port
| 99453 | BAS-48-1 C | Basic Switch 10/100/1000 BaseT 48 port
| 98965 | ENT-48-10F | Enterprise Switch 10GigE SFP+ 48 port
| 33 | 87899 | ADV-48-10F | Advanced Switch 10 GigE Copper/Fiber 44 port coppe
mysql> SELECT OrderID, CustomerID, SKU FROM Orders limit 10;
+---------+------------+------------+
| OrderID | CustomerID | SKU |
+---------+------------+------------+
| 0 | 76368 | BAS-08-1 C |
| 2 | 62494 | BAS-48-1 C |
| 6 | 98077 | ENT-48-10F |
| 8 | 85882 | ENT-48-40F |
| 10 | 59384 | BAS-48-1 C |
| 14 | 96361 | ENT-48-10F |
| 15 | 67424 | ADV-48-10F |
The column
description
was generated on some Windows app, and has Carriage Return (CR -\r
) at the end.When displayed in the non-Windows app, the CR runs back to the beginning of the line, wiping out some things.
Note how two of the lines correctly show the OrderId. In those cases,
description
seems to be truncated. That is the CR was lopped off.What to do...
INSERTs
are performed.)SELECT * ...
, spell out the columns:SELECT OrderId, CustomerId, SKU, TRIM(description) ...
(I'm not sure if this will work.)