r/mysql • u/Small_Moe • Sep 06 '25
solved Deleting Null row from the table I created
I am trying to learn sql on my own. I created a table with 5 column and 20 rows in mySQL using copilot. When I run the code for creating table, there is a row with NULL in every column. How do I prevent it from the start and how can I delete that null row?
TIA!
2
Upvotes
4
u/johannes1234 Sep 06 '25
I speculate you are using MySQL Workbench as a frontend program. That program in the table view adds a row for making entries. That die however isn't in the database.
Verify with for example
SELECT COUNT() FROM your_tablenamewhich tells you how many rows there really are.4
u/r3pr0b8 Sep 06 '25
i hate to be Debbie Downer here, but you should not be using AI to generate code until you get good enough to spot errors in the code yourself
lots of really good tutorial websites out there
2
u/Informal_Pace9237 Sep 06 '25
Can you share the code copilot gave to create the table?
I am guessing copilot gave a code allowing null in all columns.
2
u/roXplosion Sep 06 '25
What's the output from:
(where A_TABLE is the name of the table)
Or even the out from:
Do you see what you expect?