- The first task is to create a small example database. To do so
copy and paste the SQL statements from
http://www.macs.hw.ac.uk/~trinder/DbInfSystems/ to create and
populate the Emp employee, Dept department, Salgrade Salary Grade and (empty) Bonus tables.
Hint: You can cut and paste SQL commands from the web page for this practical at http://www.macs.hw.ac.uk/~trinder/DbInfSystems/
- You can check the contents of your new tables with the simple queries:
SELECT * FROM Emp;
SELECT * FROM Dept;
SELECT * FROM Salgrade;
SELECT * FROM Bonus;
- Now create a view, and check it's contents.
CREATE VIEW Emp_View AS SELECT ename, empno FROM Emp;
SELECT * FROM Emp_View;
- To preserve your newly created database you must either commit your updates, or quit from MySQL. Commit your new
tables in your database:
commit;