+ 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

21st May 2021, 5:42 PM
Jazzy85
+ 4
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
11th Dec 2021, 2:08 AM
ellis spinks
+ 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
21st May 2021, 10:16 PM
dozule
+ 3
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
21st May 2021, 10:32 PM
dozule
+ 2
Thanks for your time man i appreciate it very much
21st May 2021, 10:29 PM
Jazzy85
+ 2
thanks to you, I can now calmly analyze everything and draw conclusions
21st May 2021, 10:42 PM
Jazzy85
+ 2
SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students, teachers WHERE students.teacherid = teachers.id ORDER BY students.id
14th Nov 2021, 1:24 PM
Vidit Pawar
+ 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
21st May 2021, 9:40 PM
dozule
+ 1
I think I get it now. I answer soon.
21st May 2021, 10:11 PM
dozule
+ 1
Oh my gosh ðŸ˜‚ it's WORKING WORKING BRO THANK YOU SO SO MUCH FOR YOUR HELP UNBELIEVABLE YOU DID IT
21st May 2021, 10:28 PM
Jazzy85
+ 1
Wait a minuit, you need use JOIN! ;-)
21st May 2021, 10:29 PM
dozule
+ 1
Yes i heard about JOIN, INNER ... People says in sololearn they give old version of the solution
21st May 2021, 10:32 PM
Jazzy85
+ 1
I memtioned it because you wrote originally "JOIN, Table Operations". See above. Anyway, don't mention it. No big deal.
21st May 2021, 10:43 PM
dozule
+ 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.
22nd May 2021, 3:55 AM
Infinity
+ 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
23rd May 2021, 1:20 PM
Supriyo Baidya
+ 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
14th Jul 2021, 5:11 PM
Yosua Philip Sirait
+ 1
SELECT students.id, students.firstname, students.lastname, teachers.lasname FROM students, teachers WHERE students.teacherid = teachers.id ORDER By students.id
16th Jul 2021, 4:05 AM
Supriyo Baidya
+ 1
None of these is the right answer
23rd Nov 2021, 12:47 AM
Danjuma Okpanachi Is-ma-el
+ 1
None of theses are the right answer, ive tried multiple times with many variations and nothing is working.
11th Dec 2021, 1:44 AM
ellis spinks
+ 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
18th Apr 2022, 5:48 PM
Liza Belova
+ 1
SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher FROM students LEFT JOIN teachers ON students.teacherid=teachers.id ORDER BY students.id;
5th Oct 2022, 3:51 PM