You are viewing a single comment's thread from:
RE: SQL Beginner's Tutorial: JOIN Me and Together We Will Rule the Universe
@dbzfan4awhile, pls how can u fetch the name of students that has the same username and password from a database.
@dbzfan4awhile, pls how can u fetch the name of students that has the same username and password from a database.
Are you wanting to know the number of unique rows that contain the same username and passwords?
@dbzfan4awhile, thanks for ur quick response!! I believe each students record in a database must have a row. But I want to know how to fetch the record of students that has the same username and password.
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.
Wao, this is great!! I really admire you. If I have any questions will let you know. Keep it up @dbzfan4awhile
Sounds good.