+ 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
56 ответов
+ 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
+ 5
SELECT students.id, students.firstname, students.lastname, teachers.lastname AS teacher
FROM students, teachers
WHERE students.teacherid = teachers.id
ORDER BY students.id
+ 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
+ 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
+ 2
Thanks for your time man i appreciate it very much
+ 2
thanks to you, I can now calmly analyze everything and draw conclusions
+ 2
SELECT DISTINCT subject
FROM teachers;
+ 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
None of theses are the right answer, ive tried multiple times with many variations and nothing is working.
+ 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
+ 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;