| Author |
Topic |
|
maeganjones
Starting Member
1 Post |
Posted - 2011-06-18 : 22:23:03
|
| This is my first time using SQL and I am having a ton of trouble with one section of my code. If you have time could you please tell me what I am doing wrong. The error messages are in the INSERT INTO statements. There is an error for every Value for the lname, fname, and address. I have copied and pasted the code that I have, I put the errors in red to make it easier to see them.Create database testuse testCreate table job_title(jobid int identity Not Null,EEO1 varchar(25) Not Null,JobTitle varchar(25) Not Null,JobDesc varchar(500) Not Null,ExemptNonExempt varchar(10) Not Null,Primary Key(jobid))Create table employees(Empid int identity Not Null,Lname varchar(15) Not Null,Fname varchar(15) Not Null,Address varchar(50) Not Null,City varchar(20) Not Null,State char(2) Not Null,Areacode varchar(3) Not Null,phone varchar(7) Not Null,EEO1 varchar(25) Not Null,Hiredate date Not Null,Salary money Not Null, Gender char(1) Not Null,Age char(3) Not Null,Primary Key(Empid),Unique(Empid),Foreign Key(Empid) References job_title(jobid))INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Edelman’, ‘Glenn’, ‘175 Bishops Lane’, ‘La Jolla’, ‘CA’, 619, 5550199, ‘Sales Workers’, ‘10/7/2003’, 21500.00, ‘M’, 64)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘McMullen’, ‘Eric’, ‘763 Church St.’, ‘Lemongrove’, ‘CA’, 619, 5550133, ‘Sales Workers’, ‘11/1/2002’, 13500.00, ‘M’, 20)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Slentz’, ‘Raj’, ‘123 Torrey Dr.’, ‘North Clairmont’, ‘CA’, 619, 5550123, ‘Officials & Managers’, ‘6/1/2000’, 48000.00, ‘M’, 34)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Broun’, ‘Erin’, ‘2045 Parkway Apt2B’, ‘Encinitas’, ‘CA’, 760, 5550100, ‘Sales Workers’, ‘3/12/2003’, 10530.00, ‘F’, 24)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Carpenter’, ‘Donald’, ‘927 Second St.’, ‘Encinitas’, ‘CA’, 619, 5550154, ‘Office Clerical’, ‘11/1/2003’, 15000.00, ‘M’, 18)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Esquivez’, ‘David’, ‘10983 N. Coast Hwy Apt902’, ‘Encinitas’, ‘CA’, 760, 5550108, ‘Operatives’, ‘7/25/2003’, 18500.00, ‘M’, 25)INSERT INTO employees (lname, fname, address, city, state, areacode, phone, EEO1, hiredate, salary, gender, age) VALUES(‘Sharp’, ‘Nancy’, ‘10793 Montecino Rd.’, ‘Ramona’, ‘CA’, 858, 5550135, ‘Sales Worker’, ‘7/12/2003’, 21000.00, ‘F’, 24)INSERT INTO job_title (EEO1, JobTitle, JobDesc, ExemptNonExempt) VALUES('Officials&Managers', 'Asst Manager', 'Supervises and coordinates activities of workers in department of food store. Assists store manager in daily operations of store.', 'Exempt')INSERT INTO job_title (EEO1, JobTitle, JobDesc, ExemptNonExempt) VALUES('Sales Workers', 'Bagger', 'Places customer orders in bags. Performs carryout duties for customers.', 'NonExempt')INSERT INTO job_title (EEO1, JobTitle, JobDesc, ExemptNonExempt) VALUES('Sales Workers', 'Cashier', 'Operates cash register to itemize and total customers purchases in grocery store.', 'NonExempt')INSERT INTO job_title (EEO1, JobTitle, JobDesc, ExemptNonExempt) VALUES('Operatives', 'Retail Asst Bakery & Pastry', 'Obtains or prepares food items requested by customers in retail food store.', 'Exempt')Thanks, Maegan |
|
|
paulalvin
Starting Member
8 Posts |
Posted - 2011-06-18 : 23:52:10
|
| I think this is your error "Empid int identity"please be guided that when you insert values on the table column you must insert all column and it must be the same on how you code the program(orderly)for exampleINSERT INTO employees (Empid, Lname, Fname, Address, City, State, Areacode, phone, EEO1, Hiredate, Salary, Gender, Age) based on your code it seems that the column specified inside the parenthesis is properly arranged, and remember this is 'case sensitive' meaning if you declare it in uppercase you must also use this in uppercase |
 |
|
|
|
|
|