Join 150,007 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,366 people online right now. Registration is fast and FREE... Join Now!
Hello, Back in another class, I am trying to create these two tables in MySQL. if I change the syntax between Age INT ); DROP TABLE Job; I can get it to create the tables one at a time. I am trying to get this to create both of these tables at once. Can someone tell me what I am doing wrong? Thanks, Paul DROP TABLE Employee; CREATE TABLE Employee( Employee_Id CHAR(10)NOT NULL PRIMARY KEY, Last_name CHAR(20), First_name CHAR(20), Address VARCHAR(20), City CHAR, State CHAR, Telephone_area_code VARCHAR(20), Telephone_number VARCHAR(20), Exempt_NonExemptStatus CHAR, Hire_date INT, Salary INT, Gender CHAR, Race CHAR, Age INT ); DROP TABLE Job; CREATE TABLE Job( Exempt_Non_Exempt_Status tinyint(1) NOT NULL PRIMARY KEY, Job_title CHAR, EEO_1_Classification CHAR, Job_description CHAR );
Hello, Back in another class, I am trying to create these two tables in MySQL. if I change the syntax between Age INT ); DROP TABLE Job; I can get it to create the tables one at a time. I am trying to get this to create both of these tables at once. Can someone tell me what I am doing wrong? Thanks, Paul DROP TABLE Employee; CREATE TABLE Employee( Employee_Id CHAR(10)NOT NULL PRIMARY KEY, Last_name CHAR(20), First_name CHAR(20), Address VARCHAR(20), City CHAR, State CHAR, Telephone_area_code VARCHAR(20), Telephone_number VARCHAR(20), Exempt_NonExemptStatus CHAR, Hire_date INT, Salary INT, Gender CHAR, Race CHAR, Age INT ); DROP TABLE Job; CREATE TABLE Job( Exempt_Non_Exempt_Status tinyint(1) NOT NULL PRIMARY KEY, Job_title CHAR, EEO_1_Classification CHAR, Job_description CHAR );
Hi
If I have understaood you correctly, you are expecting the RDBMS to parallel process the creation of the tables.
As far as I know, the engine will serialise and atomize (mmm great words) the transactions and would never create tables in parallel.
(to dream the impossible dream)
over to you to clarify if I am misunderstanding your question.
Hello, Back in another class, I am trying to create these two tables in MySQL. if I change the syntax between Age INT ); DROP TABLE Job; I can get it to create the tables one at a time. I am trying to get this to create both of these tables at once. Can someone tell me what I am doing wrong? Thanks, Paul DROP TABLE Employee; CREATE TABLE Employee( Employee_Id CHAR(10)NOT NULL PRIMARY KEY, Last_name CHAR(20), First_name CHAR(20), Address VARCHAR(20), City CHAR, State CHAR, Telephone_area_code VARCHAR(20), Telephone_number VARCHAR(20), Exempt_NonExemptStatus CHAR, Hire_date INT, Salary INT, Gender CHAR, Race CHAR, Age INT ); DROP TABLE Job; CREATE TABLE Job( Exempt_Non_Exempt_Status tinyint(1) NOT NULL PRIMARY KEY, Job_title CHAR, EEO_1_Classification CHAR, Job_description CHAR );
Hi
If I have understaood you correctly, you are expecting the RDBMS to parallel process the creation of the tables.
As far as I know, the engine will serialise and atomize (mmm great words) the transactions and would never create tables in parallel.
(to dream the impossible dream)
over to you to clarify if I am misunderstanding your question.
Thanks for the reply, Obviously I am new at this and thought I might be able to write all the code for all the tables so it would create them all at once. What about bringing in the data, Is it possible to create all the tables then bring in all the data to all the tables at once or does that have to be done table by table also?
This post has been edited by nmpaulcp: 12 Dec, 2006 - 08:51 AM
Hello, I just created the tables below and need to insert data.
CODE
DROP TABLE IF EXISTS job; CREATE TABLE job ( Job_Id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, EEO_1_Classification CHAR(40), Job_title CHAR(50), Job_description VARCHAR(250), Exempt_Non_Exempt_Status CHAR(15) NOT NULL, PRIMARY KEY(Job_Id)
); DROP TABLE IF EXISTS Employee; CREATE TABLE Employee ( Employee_Id INT UNSIGNED NOT NULL AUTO_INCREMENT, Last_name CHAR(20), First_name CHAR(20), Address VARCHAR(30), City CHAR(15), State CHAR(15), Telephone_area_code VARCHAR(20), Telephone_number VARCHAR(20), EEO_1_Classification CHAR(25), Hire_date DATE, Salary INT, Gender CHAR, Race CHAR, Age INT, PRIMARY KEY (Employee_Id), Job_Id INTEGER UNSIGNED, FOREIGN KEY (Job_Id) REFERENCES job(Job_Id) );
When I created the data for TABLE job I made a primary key number as in this example.
INSERT INTO JOB VALUES ( '2001','OFFICE CLERICAL','ACCOUNTING CLERK','Computes, classifies, records, and verifies numerical data for use in maintaining accounting records.','NON EXEMPT'); and inserted into the TABLE job. Now I need to insert Employee data into TABLE Employee. An example of what i have looks like this when I tried to add data Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> USE kud Database changed mysql> INSERT INTO EMPLOYEE -> -> VALUES -> -> ('1001','EDELMAN','GLENN','175 BISHOPS LANE','LA JOLLA','CA','619','55501 99', -> 'SALES WORKERS','20031007','21500.00','M','CAUCASIAN','64' ); ERROR 1136 (21S01): Column count doesn't match value count at row 1 mysql> The reason for the column count not matching is because I added a foreign key which is the PRIMARY KEY from job table. My question is do I have to copy the data manually from the job table or can I add to the insert statement for emplyees so it will allow for the data to come directly from the job table?