Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small comments aliasing (03-sql-joins) #270

Open
MathildeMousset opened this issue Apr 30, 2019 · 1 comment
Open

Small comments aliasing (03-sql-joins) #270

MathildeMousset opened this issue Apr 30, 2019 · 1 comment
Labels
type:discussion Discussion or feedback about the lesson

Comments

@MathildeMousset
Copy link

I was confused by the example on aliasing at the end of 03-sql-joins.

I don't think that changing all by-now remembered tables and field names is making the query clearer, just shorter. It is, however, harder to read, as one has now to concentrate extra hard to learn the new names. Why renaming the tables?

I would simplify the example as below:

SELECT 
    surveys.year  AS year, 
    surveys.month AS month, 
    surveys.day   AS day, 
    species.genus AS genus, 
    species.species AS species
FROM surveys 
JOIN species 
ON surveys.species_id = species.species_id;

Additionaly, I did not wanted to create an issue, just for that, but maybe it would be good to introduce aliasing much before it is done, so that learners are exposed to it, and can use it in examples and challenges of all episodes.

juanfrh pushed a commit to juanfrh/sql-ecology-lesson that referenced this issue Apr 16, 2020
@ChristinaLK ChristinaLK added the type:discussion Discussion or feedback about the lesson label Aug 12, 2020
@ChristinaLK
Copy link
Contributor

ChristinaLK commented Aug 12, 2020

Thanks for this observation @MathildeMousset. I think the reason to alias the tables is as you've mentioned - to make the query shorter - because otherwise it takes FOREVER to type. However, the speed comes at the cost of clarity! I think it would be worth hearing from people who have taught the lesson about the trade-offs.

(We do introduce aliases in a previous episode, so this is not the first time they appear, but we could maybe use them in more exercises so that people are familiar with them).

Discussion question: is it better to include the full table names (clearer, but longer) or alias them (shorter, but harder to read)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:discussion Discussion or feedback about the lesson
Projects
None yet
Development

No branches or pull requests

2 participants