Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
551 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | SQL (203 exercises) |
Topic ==> | Creating tables (7 exercises) |
Level ==> | Average difficulty |
Subject ==> | SQL training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
If you haven't already done so, run the stored procedure in the above folder to generate a database of books and authors.
Create a query or stored procedure to create the following table of book genres called tblGenre (the rating is a number between 1 and 10 you can assign to each genre):
The table should have 3 columns - you get bonus points for indexing the GenreName column
Now add code to insert records into this table then display them - here's a suggestion for what to add:
If you don't like science fiction, your ratings will be different
Run your query to check it works - you should see something like this:
Here we've also used @@IDENTITY to show the id number of the last row added
Now run your query again - it should now fall over, because the tblGenre table already exists.
Add a statement at the start of your query to drop the tblGenre table if it exists, and run the query again - it should now work.
Optionally, save your query as Generate genres.sql, then close it down.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.