MySQL Assignment
Copy and paste is a dangerous thing and I messed up in a few places. Hopefully I have caught them all with your help.
- Create a MySQL table with a minimum of two varchar fields,
a char field, a numeric field with decimal places, a numeric field for a whole
number.
- Show me a description of the table.
- Populate the table with data you should put in a variety of data so that
it can be effectively queried. One of the varchar fields should contain a name in the format last name slash first name middle name or initial if any. For example:
- Doe/John M
- Jones/Mary
- Adams-Costa/Susan Ann
Langley/M Richard
- Change a record and show me the before and after.
- Do a query that does a sort on two fields. Tell me which field is the primary sort and
which is the secondary sort. Show me the results.
- Calculate a code number in the following way using the table you created above. The number has to be the second,third and fourth characters
of one of your fields concatenated with the answer from a calculation, concatenated with the mod from your numeric field divided by 3,
concatenated with the length of one of your fields, concatenated with the lower case version of one of your fields.
- Alter the structure of the table by adding a column/field and populating it. Show me the results.
- Show all records with condA true and either condB or condC true.
- Using the table you created group on one field and show me the count and the sum of your numeric field.
- Repeat the query above but exclude one or more records as you form the groups.
- Repeat the query again but now you should also exclude one of the groups from the list.
- Pick a field from your table such as dept or state or something else that occurs multiple times. If you do not have something, add a field to your table and populate it. You are going to form groups based on the field. Now eliminate one or more records from the groups as you are forming them. Then I want you to eliminate one or more groups before you display. I want the display to be in order by the field and I want to see a sum and
average of something when you display.
- The name you defined should now be altered. I want you to display the name as first, space, middle last. So Doe/John M would be John M Doe
and Jones/Mary would become Mary Jones.