You open a shop’s customer table and run this query. The result has 360 rows. Every cell says *. Where did the customers go?
SELECT '*'
FROM users;
Open the customer table in SQLBrief. Type the query above into the editor and run it. The exercise asks for the full customer record, so this first attempt won’t pass. The result is still worth reading: SQL found one row for each account and wrote the same piece of text into every row.
Now remove the two single quotes and run the query again. Look across the first row. You should see seven column headings, including user_id, signup_date and country_code. Both queries read the same 360 accounts. The bare star tells SQL to return every column from the table. The quoted star asks for a single text value.
Try it again from memory
Choose Next task to open Choose the table for the query. This time the shop wants just the account ID, status and acquisition channel. Which number should change: the row count or the column count? Fill in the missing table name, insert it into the query and run it to check your prediction.
If you want to finish tomorrow, bookmark the second task after inserting the table name. Open it in the same browser and your SQL will still be in the editor.
About the author
- I'm Aleks, building SQLBrief. I write about SQL mistakes that change the meaning of a report, with examples you can run yourself. SQLBrief offers browser-based SQL practice in English and Russian.
Comments
Join the discussionNo comments yet. Be the first to comment.
