Aliases
The outputs of the last two tasks were single columns with single values. If you noticed, this column had a name count
, which is not, to be honest representative. Seems like it's only a matter of taste. But in the future, when you will work with multiple tables, will join one table to another, the same names will be a huge problem. Even from the point of interpreting the data.
In SQL you can easily declare a new name to a column by using AS
statement. For example,
12SELECT COUNT(DISTINCT(country)) AS "number of countries" FROM visitors
This query will return a single value in the single column named number of countries
, which is much readable than count
.
Please note, that the aliases you use must be placed within double-quotes. Using single quotes will result in SQL error!
Swipe to start coding
Extract unique types of fuel consumed by cars (column fueltype
) and name this column as "Fuel type".
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Awesome!
Completion rate improved to 2.63Awesome!
Completion rate improved to 2.63
Aliases
The outputs of the last two tasks were single columns with single values. If you noticed, this column had a name count
, which is not, to be honest representative. Seems like it's only a matter of taste. But in the future, when you will work with multiple tables, will join one table to another, the same names will be a huge problem. Even from the point of interpreting the data.
In SQL you can easily declare a new name to a column by using AS
statement. For example,
12SELECT COUNT(DISTINCT(country)) AS "number of countries" FROM visitors
This query will return a single value in the single column named number of countries
, which is much readable than count
.
Please note, that the aliases you use must be placed within double-quotes. Using single quotes will result in SQL error!
Swipe to start coding
Extract unique types of fuel consumed by cars (column fueltype
) and name this column as "Fuel type".
Solution
Merci pour vos commentaires !
single
Awesome!
Completion rate improved to 2.63
Aliases
Glissez pour afficher le menu
The outputs of the last two tasks were single columns with single values. If you noticed, this column had a name count
, which is not, to be honest representative. Seems like it's only a matter of taste. But in the future, when you will work with multiple tables, will join one table to another, the same names will be a huge problem. Even from the point of interpreting the data.
In SQL you can easily declare a new name to a column by using AS
statement. For example,
12SELECT COUNT(DISTINCT(country)) AS "number of countries" FROM visitors
This query will return a single value in the single column named number of countries
, which is much readable than count
.
Please note, that the aliases you use must be placed within double-quotes. Using single quotes will result in SQL error!
Swipe to start coding
Extract unique types of fuel consumed by cars (column fueltype
) and name this column as "Fuel type".
Solution
Merci pour vos commentaires !