CPSC-110 Computers, Information and Society
Table Creation and Data Clean-Up Instructions
Table Creation
Use this time to create your database and tables for your project. Be sure to follow these guidelines:
- First, you must select one person's MySQL account in which to create your database and tables. You will only need to share the MySQL user name and password, not your Linux user name and password.
- Next, you must log into that account and create a database. Refer to Lab 5 for instructions on how to create a database. Remember:
- The database must begin with the MySQL user name of the account that you are using
- The database name may not contain any spaces
- The database name must only contain letters
- Start with the Data Details section of part 1 of the project
- Make any modifications to tables and/or columns recommended in the instructor feedback
- Create each table, one at a time. Remember:
- Table and column names must not have spaces
- Table and column names must not start with a number
- Table and column names must not be an SQL reserved word such as "order" or "year"
- Table and column names must only contain characters and numbers and must not contain characters such as: &%^()#@! or other non-alphanumeric characters
- Use the proper MySQL data type for each column
- If the column have a row with no data in it (missing data), you must uncheck the not null option for that column.
- If you run into trouble, ask another group for help
Data Preparation
In order to be ready to upload your data into your MySQL database that you have created, you must have your data in comma separated value (CSV) format. Therefore, your data must:
- Go to the URL that you provided for your data and download the appropriate data. You may need multiple downloads.
- Open your data using Excel or OpenOffice. Edit the data so that you have eliminated extra rows and columns. You should have either a separate spreadsheet that corresponds to each table or a separate sheet within the spreadsheet that corresponds to each table.
- You must have one file with a .csv ending that corresponds with each table in your database
- One easy way to get this data is to open your data in Excel, save the data for a table to a new sheet and then do a "save as" on that sheet.
- Edit the .csv file so that the first row in the data file should contain the names of the columns exactly as you specified them when you created your tables including case and underscores.
- The data may appear enclosed within quotes. This is acceptable, even for numeric data. MySQL will do the conversion to the proper numeric type when it uploads the data.
- Check your data to ensure that you do not have commas in incorrect places. For example, a column that holds addresses might have a data item "Main St., Hartford". The comma between Main St and Hartford would be interpreted as a separator and must be removed.
- If you have columns of numeric data that have odd characters (e.g,. * or #), you must replace these with a blank. Using KWrite, you can use the Edit->Replace command to do a global replace.
- I have provided a sample data file that I have successfully uploaded into MySQL.