SQL offers the option of views. Views are virtual tables.
Creating a view
It's very easy to create a view in SQL, since the syntax is very similar to selection but with an additional part:
SQL
CREATE VIEW test_view AS SELECT surname, SHA1(surname) FROM `Attendees`
It's common to indent the statement under a view as above, but it is still one single SQL query.
Updating a view
Views can also be updated. Assuming the original data has changed and the view needs to be recreated based on the new data, the following SQL command will replace the current view with the updated information:
SQL
CREATE OR REPLACE VIEW test_view AS SELECT surname, SHA1(surname) FROM `Attendees`
The CREATE OR REPLACE VIEW
will create a view or, if it already exists, replace it.
Removing a view
Views can, obviously, be deleted. Deleting is done with the DROP
command.
SQL
DROP VIEW test_view
Did you know my courses are all printer-friendly? This means you can easily export them to PDF or print them for later use.