+ 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
Jazzy85 - avatar
56 Respostas
+ 10
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
+ 5
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
Vidit Pawar - avatar
+ 4
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
dozule - avatar
+ 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
dozule - avatar
+ 2
Thanks for your time man i appreciate it very much
21st May 2021, 10:29 PM
Jazzy85
Jazzy85 - avatar
+ 2
thanks to you, I can now calmly analyze everything and draw conclusions
21st May 2021, 10:42 PM
Jazzy85
Jazzy85 - avatar
+ 2
SELECT DISTINCT subject FROM teachers;
30th Mar 2024, 7:02 AM
Sara Zarei
+ 1
I think I get it now. I answer soon.
21st May 2021, 10:11 PM
dozule
dozule - avatar
+ 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
Jazzy85 - avatar
+ 1
Wait a minuit, you need use JOIN! ;-)
21st May 2021, 10:29 PM
dozule
dozule - avatar
+ 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
Jazzy85 - avatar
+ 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
dozule - avatar
+ 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
Abhishek Tandon
Abhishek Tandon - avatar
+ 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
Supriyo Baidya - avatar
+ 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
Yosua Philip Sirait - avatar
+ 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
Supriyo Baidya - avatar
+ 1
None of these is the right answer
23rd Nov 2021, 12:47 AM
Danjuma Okpanachi Ismael
Danjuma Okpanachi Ismael - avatar
+ 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
Liza Belova - avatar
+ 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
Mohamed Adnane