Question
Using Mysql write a script that will do the following: Also show the output separately. 1. drop/delete all of the tables/views you will be creating
Using Mysql write a script that will do the following: Also show the output separately.
1. drop/delete all of the tables/views you will be creating below
2. create a table owner with an owner id, a first name, and a last name. Owner id should be an auto-increment primary key.
3. put at least 5 records in this table
4. do a select * on this table to show all the records
5. create a table called pet with a pet id (auto-increment primary key), pet name, pet dob (as character), and ownerid
(which is a foreign key into the owner table)
6. put at least 5 records in this table, with at least two pets owned by the same owner
7. do a select * on this table to show all the records
8. add a column to the pet table for type of pet (for example: dog, cat, or fish)
9. update several rows to add the pet type
10. change the pet dob column to a date type (from
character)
11. do a select * on this table to show all the records
12. define a view that will list each owner with their pet, just the names (first and last of owner) and the pet name
13. do a select * on this view to show all the records
Once you have debugged and corrected the above sql statements, put them in the script (with comments), run the script using the \T command to put the results in a text file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started