Why SELECT * is a problem at work (and why we mark it wrong)
SELECT * feels faster. The person who asked for three columns will paste your result into a sheet that has three headers. The fourth column wrecks the paste.
What they asked for
Amy wants order_id, customer_id, total_amount. That is the contract. SELECT * also returns dates, status, staff ids, whatever the table grew last Tuesday.
-- What they asked for
SELECT order_id, customer_id, total_amount
FROM Orders
WHERE status = 'Shipped'
ORDER BY total_amount DESC;
It also breaks next month
Add a column to Orders and every SELECT * downstream changes shape. Named columns keep last quarter’s workbook working.
You will, the first time. The fifth time, someone else runs the script and they will not. Write the columns once.
When SELECT * is fine
Peeking in SSMS. SELECT TOP (20) * FROM Orders to see what a table looks like. Not in anything you send, save, or schedule.
Try it on Harbour & Co
Amy Nair (Finance Lead) needs this now: “Can I get a customer contact list? Just first name, last name and email.” Write the query, run it, send the results. Free.
Take the ticket →Learn it on a real ticket
Monday is free on WorkSQL. A colleague’s ticket lands, you write the T-SQL, we mark it. No videos. Five minutes.
Clock in free See Monday’s tickets