SQL as any programming language has the notion of comments – parts of the query that are not a query. If you open the Playground you’ll see the first default query:
-- This is your very first SQL query.
-- It lists all records from the users table:
SELECT *
FROM users
As you can see the first 2 lines are just a comment about what the query is doing. Comments are very useful for documentation of hacks/techniques you used in a query so other people (or you in 3 months) can understand what’s going on.
--
style comments are very handy when you need to comment out just one line. If you want to write a bigger comment you can also use /* ... */
style:
/* This is your very first SQL query.
It lists all records from the users table. */
SELECT *
FROM users
All queries you’ll write in the SQL Habit course will be available to you in History. So if you found a nice hack or learned something new – make sure to drop a comment in your query so you can retrieve it later.
Hi, it’s Anatoli, the author of SQL Habit.
SQL Habit is a course (or, as some of the students say, “business simulator”). It’s based on a story of a fictional startup called Bindle. You’ll play a role of their Data Analyst and solve real-life challenges from Business, Marketing, and Product Management.
SQL Habit course is made of bite-sized lessons (you’re looking at one atm) and exercises. They always have a real-life setting and detailed explanations. You can immediately apply everything you’ve learned at work.