Selecting columns effectively
If you are familiar with other database management systems, you may have developed some “SQL muscle memory” regarding making do with some of the more tedious parts of writing SQL. In this section, we are going to explore some of the DuckDB niceties – little shortcuts and tweaks to make your use of DuckDB easier.
For the first set of exercises, we are going to take to the mountains with some ski-related data exercises. We will explore a variety of ways to nominate the columns for our queries, and learn how to replace values and mechanisms to exclude unwanted columns.
Let’s head to the slopes and start with some data about skiers:
CREATE OR REPLACE TABLE skiers AS SELECT * FROM read_csv('skiers.csv');
With our table created, we can query our list of skiers:
SELECT * FROM skiers;
The preceding code will show all the rows and columns of the skiers
table:
Figure 10.1 – Selecting...