RE: SQL Beginner's Tutorial: JOIN Me and Together We Will Rule the Universe

You are viewing a single comment's thread from:

SQL Beginner's Tutorial: JOIN Me and Together We Will Rule the Universe

in sql-forbeginners •  7 years ago 

In reference to my SchoolChildren table this wouldn't happen because there's no actual username field, there's an id field which is a unique integer and first- and last-name fields.

If, by chance, you had multiple kids in the same class with the same first and last name and you were trying to find out how many "multiples" you have, you could do the following:

SELECT DISTINCT COUNT() AS child_duplicate_count, first_name, last_name
FROM schoolchildren
GROUP BY first_name, last_name
HAVING COUNT(
) > 1

You will notice that there are components of this query that I have not went over yet in my lessons, so this is like you're reading ahead in your textbook.

Thanks to this question, I'll be trying to put that in my next tutorial.

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Wao, this is great!! I really admire you. If I have any questions will let you know. Keep it up @dbzfan4awhile

Sounds good.