Wednesday, May 15, 2019

SQL Queries Essay Example | Topics and Well Written Essays - 750 words

SQL Queries - Essay ExampleDescriptionI rich person added a sub doubt in WHERE clause to filter those students who mystify no spatial relation.f.List the names and student ids for students who have gained utilisation with the company that they undertook a placement at.SELECT DISTINCT Student.stu_fname, Student.stu_noFROM Employment, Student, PlacementWHERE Student.stu_no=Employment.stu_no And Student.stu_no=Placement.stu_no And Placement.co_id=Employment.co_idDescriptionIn this query I have selected Employment, Student, Placement tables and have joined them. In addition to that, I have also spotted Company ID of Placement with Employment table as well.g.List the names and student ids for students that have undertaken scarce dickens (2) placements.SELECT DISTINCT Student.stu_fname, Student.stu_noFROM StudentWHERE (( SELECT count(*) FROM Placement WHERE (Student.stu_no=Placement.stu_no) ) = 2 )DescriptionI have added a sub query in WHERE clause to filter those students who have at least two placements.h.List the names and student ids for all students and sort the list in reversed alphabetical mold (Z to A).SELECT DISTINCT Student.stu_fname, Student.stu_noFROM StudentORDER BY Student.stu_fname DESCDescriptionIn this query I have added ORDER BY clause to sort data in Descending order. i.Show the average length for placements, where the placement is with Sony and the student goes on to gain employment (with any company).SELECT Company.co_name, avg(SELECT count(*) FROM Placement, Student, Employment WHERE Placement.co_id=Company.co_id and student.stu_no=Employment.stu_no And student.stu_no=Placement.stu_no )FROM company crowd BY Company.co_name, Company.co_idHAVING Company.co_name=SonyDescriptionFirst I have selected the Average number of placements... In a powerful implemented database a student may not be employed and on a placement at the same point in time. However in much(prenominal) a database it is still possible for a student to secure employment before they have completed their placement (i.e. having a commencement date for employment while still on placement). Create a query that lists all such occurrences.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.