MySQL Forums
Forum List  »  General

Populating a table
Posted by: tim woodhouse
Date: September 02, 2016 06:05PM

I am relatively new to Computer Information Systems. Currently I am working towards a Degrees in CIS with a specialization in Database Management. After being introduced to this field I have gained an immense passion for programming. At the moment I have started teaching myself how to navigate through MySQL.

Here is the problem:

I have constructed a data-base containing two tables: Table 1: stored-schedule Table 2: active-schedule

Table1: (contains) 2 fields: Column 1: schedule_id (integer) Column 2: schedule. (Blob)

Table 2: (contains) multiple fields: This table is an outline of a Schedule: -id_num -first_name -last_name -monday_in -monday_out -monday_hours .........etc through Sunday

Now, I have built an excel document that I can build a schedule on. This "workbook" has multiple sheets. One of the sheets is named "data-sheet" this sheet is formulated to copy the values from only the cells that I need. I have saved the "active sheet" as a .csv. At the moment I can do two things with this file:

1.Save the .csv file as a BLOB data type in the "schedule" field of Table 1, with a schedule_id as "1" ( manually entering in 1 after "select * from...." Query).

2.Populate Table 2 with the .csv file by importing it from my saved files.
I would like to find this out: How can I use one row from table 1 (stored_schedule), as in 1 BLOB, to populate Table 2 (active_schedule).

ps. I have also built a Windows form GUI that will allow me to interact with the database. As of right now I'm not worried about the syntax for the connection (I have that already working as I research all my problems through this community, remember trying to self teach 🤓.

Here is the "logic" of the "application": -navigate through the application to arrive at "schedule" form.

-enter in a integer (primary key) that will correspond to the stored schedule. I have also wondered if it is possible to use a DATE datatype as a primary key?

END RESULT- after entering the PK the database I want one of two things to happen: 1. After entering in the primary key the application will send a query to my MYSQL database and have "that" BLOB file populate the active_table and then retrieve the active_table and display the data on a table in the Windows form application. (Or) 2. After entering in the primary key the application will query MySQL to import the BLOB data into a display table in the Windows form app.

I am having trouble with the END RESULT (lol). I don't know the query that I need.

I have performed tests as in using: LOAD DATA INFILE with MySQL workbench queries. Multiple errors and troubleshooting: Errors: 2-26-1046 ........ I have manipulated the my.ini configuration file (secured_file_priv line) I have changed the MySQL "mode" (which allowed me to import the data independently).

I am at a lost........what queries will allow me to execute the process that I need to populate Table 2 from a single field in Table 1?

Options: ReplyQuote


Subject
Written By
Posted
Populating a table
September 02, 2016 06:05PM
September 03, 2016 05:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.