Once you are happy with your private database you can do the following
Run the following queries, and explain in an English sentence what the query means.
SELECT ENAME, JOB
SELECT ENAME, JOB, SAL
WHERE SAL > 2500;
SELECT ENAME, DNAME
FROM Emp e, Dept d
WHERE e.DEPTNO = d.DEPTNO;
Write queries to obtain the following information.
Hint 1: It's easiest to create and edit SQL queries in a text
editor window (e.g. emacs), and then copy and paste them into your MySQL
Hint 2: You can also cut and paste the result of an MySQL query
into the editor window. As an aid for later study you're advised to maintain a file containing your SQL queries and the corresponding tables.
Print the contents of the dept table.
Print the name and location of all departments.
Print the department nos of of all employees.
Without repetition print the department nos of of all employees.
Print the name of all employees, together with the department no they work in.
Print the name of all employees, together with the name of the department they work in.
Hint: You need to join the Emp and Dept tables.
Print the name of all employees who work in the sales department.
Print the salary bill for department 20.
Hint: Use an aggregate function.
Print the department no and salary bill for all departments.
Hint: Use grouping.
Print the name of all employees who are on salary grade 1.
Print the name and department name of all employees who are on salary grade 1.
Print the department name and the number of employees who are on salary grade 1.
Write some queries that use join, e.g. find all staff working in Chicago.