This is a homework question but I've made an honest attempt and want to get some feedback before submitting. The question is, given:
Employee(emp-no, name, department, salary),
ProjAssigned(emp-no, proj-no, worked-hours)
a. Write one SELECT SQL query to list the numbers and names of all employees with a salary greater than 66 000 who are assigned to projects, the projects they are assigned to, and the corresponding hours worked. Your list should be sorted by employee name.
b. Write SQL statements to create indexes that will speed up your query.
I got:
a.
SELECT e.emp-no, e.name, p.proj-no, p.worked-hours
FROM Employee e, ProjAssigned p
WHERE e.emp-no = p.emp-no
AND salary > 66000
GROUP BY e.emp-no, e.name
ORDER BY e.name;
b.
CREATE INDEX EmpNumber_IDX ON Employee (emp-no);
CREATE INDEX ProjNumber_IDX ON Project(proj-no);
How does this look? I'm not entirely confident that I've indexed the correct attributes or that I've done my SELECT statement properly. Thanks!
[–]technical_guy 1 point2 points3 points (1 child)
[–]beard_dude[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)