Skip to content

Instantly share code, notes, and snippets.

@ashga
Created October 16, 2012 18:47
Show Gist options
  • Save ashga/3901183 to your computer and use it in GitHub Desktop.
Save ashga/3901183 to your computer and use it in GitHub Desktop.
Question 4 & 5 Database
4a. select * from employee where age > 40;
4b. select top 1 * from employee order by age desc;
4c .select top 1 lastname,count(*) as count from employee group by lastname order by count desc;
4d. select lastname,count(*) as count from employee where count > 10 group by lastname HAVING COUNT(lastname) > 10 order by count desc;
5. SELECT employee.lastname +', '+employee.forename as 'employee_name' ,department.deptdesc AS 'department'
FROM department INNER JOIN
employee ON department.id = employee.deptid;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment