plz i need help!!! sql | Sololearn: Learn to code for FREE!

+4

plz i need help!!! sql

JOIN, Table Operations 1.2 Practice You are given the following students and teachers tables students (with their teachers ID's): Write a query to output all of the students with their teachers' last names in one table, sorted by students ID. SELECT students.id, students.firstname, students.lastname, students.teacherid AS teacher from students, teachers WHERE students.teacherid = teachers.lastname ORDER BY sdudents.id

5/21/2021 5:42:50 PM

Jazzy85

51 Answers

New Answer

+4

select s.id, s.firstname, s.lastname, t.lastname as teacher from students s inner join teachers t on s.teacherid = t.id order by 1

+3

select s.id, s.firstname, s.lastname, t.lastname as teacher from students s, teachers t where s.teacherid = t.id order by 1

+3

Thanks for your time man i appreciate it very much

+3

So it took a while but here is the actual code u need to complete this task: SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students, teachers WHERE students.teacherid=teachers.id ORDER BY students.id

+2

thanks to you, I can now calmly analyze everything and draw conclusions

+2

SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students, teachers WHERE students.teacherid = teachers.id ORDER BY students.id

+1

select s.id, s.firstname, s.lastname, t.lastname as teacher from students s, teachers t where s.id = t.id order by 1

+1

I think I get it now. I answer soon.

+1

Oh my gosh 😂 it's WORKING WORKING BRO THANK YOU SO SO MUCH FOR YOUR HELP UNBELIEVABLE YOU DID IT

+1

Wait a minuit, you need use JOIN! ;-)

+1

Yes i heard about JOIN, INNER ... People says in sololearn they give old version of the solution

+1

I memtioned it because you wrote originally "JOIN, Table Operations". See above. Anyway, don't mention it. No big deal.

+1

SELECT students.id, students.firstname, students.lastname, teachers.lasname FROM students, teachers WHERE students.teacherid = teachers.id ORDER By students.id I know I am late, just delivering what I promised.

+1

select s.id, s.firstname, s.lastname, t.lastname as teacher from students s inner join teachers t on s.teacherid = t.id order by 1

+1

SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students, teachers WHERE students.teacherid = teachers.id ORDER BY students.id; Try this dude

+1

SELECT students.id, students.firstname, students.lastname, teachers.lasname FROM students, teachers WHERE students.teacherid = teachers.id ORDER By students.id

+1

None of these is the right answer

+1

select students.id, students.firstname, students.lastname, teachers.lastname as teacher from students inner join teachers on students.teacherid=teachers.id order by id

0

I don't see the FROM clause anywhere in your solution 🤔

0

SELECT students.id, students.firstname, students.lastname, students.teacherid AS teacher from students, teachers WHERE students.teacherid = teachers.lastname ORDER BY sdudents.id