创建artwork表后查询显示no rows selected,为何无数据返回?
select * from artwork Returns "no rows selected" Hey, no need to stress—this is totally normal behavior, not an error! Let me break down what's happening here:
Creating a table only sets up its structure
When you rancreate table artwork (...)and got theTable createdconfirmation, you just built an empty "shell" for your data. The table has all the columns you defined (artwork_id,barcode, etc.) and the primary key rule in place, but there are zero actual records stored in it yet.Your
SELECTquery is working exactly as it shouldselect * from artworktells the database to fetch every row in the table. Since you haven't added any data to the table yet, there's nothing to return—hence theno rows selectedmessage.
If you want to see data show up, you need to insert records into the table using an INSERT statement. Here's a quick example to get you started:
INSERT INTO artwork (artwork_id, barcode, title, description) VALUES (1, 'ART00001234567890', 'Mountain Landscape', 'Acrylic painting of alpine peaks at dawn');
Run that, then re-execute your SELECT query, and you'll see the row you just added!
内容的提问来源于stack exchange,提问作者agam

