Login|Contact Us
Question and Answer

Programming

Ask a Programming Question, Get an Answer ASAP!

  • Ask A Question
  • Browse Answers
  • Meet The Experts
  • How JustAnswer Works

o Write a SQL query that joins two tables in the example database

 
Raj's Avatar
  • Answered by:Raj
  • Computer Engg.
  • Positive Feedback: 98.8 %
  • Accepted Answers: 857
Verified Expert
in Programming

Recent Feedback

Positive
Excellent work and exactly what I needed..Thanks!
Positive
Thank you Raj exactly what I am looking for can I ask for your help in the...
Positive
Great job!
Positive
Very knowledgeable. Explains everything, if you're struggling with an assignment...
Positive
Thanks
Positive
Thanks
Positive
Raj did the job fast an accurately!
Positive
Raj helped me quickly and taught me alot.
Positive
RAJ is great as always!

Customer Question

o Write a SQL query that joins two tables in the example database and uses BETWEEN to restrict record selection. Use salary to restrict data.
Write a SQL query that joins two tables in the example database and uses BETWEEN to restrict record selection. Use hire dates to restrict data.

Write a SQL query that joins two tables in the example database and uses LIKE to restrict record selection. Use telephone area codes to restrict data.

Write a SQL query that joins two tables in the example database and uses LIKE to restrict record selection. Use age to restrict data.

Write a SQL query that uses the UNION of the two tables to produce a third table.

 

Optional Information:
Computer OS: Windows Vista
Browser: IE

Submitted: 1339 days and 10 hours ago.
Category: Programming
Value: $22
Status: CLOSED
Picture
Expert:  Raj replied1339 days and 10 hours ago.

Can i have a look at the database to be used??

Customer replied1339 days and 10 hours ago.

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[Employee]

GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Job_title]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[Job_title]

GO

 

CREATE TABLE JOB_TITLE

(

eeo_1_class VARCHAR (20) NOT NULL,

job_title_id VARCHAR (5) PRIMARY KEY,

job_title VARCHAR (50) NOT NULL,

job_descrip VARCHAR (100) NOT NULL,

exempt VARCHAR (4) NOT NULL

)

GO

CREATE TABLE EMPLOYEE

(

id_num INT IDENTITY (1, 1) PRIMARY KEY,

last_name VARCHAR (15) NOT NULL,

first_name VARCHAR(15) NOT NULL,

address VARCHAR (50) NOT NULL,

city VARCHAR (20) NOT NULL,

state VARCHAR (2) NOT NULL,

telephone_area_code VARCHAR (3) NOT NULL,

telephone_number VARCHAR (10) NOT NULL,

eeo_1_class VARCHAR (20) NOT NULL,

hire_date DATE NOT NULL,

salary DECIMAL (10,2),

gender CHAR(1) NOT NULL,

age INT NOT NULL,

job_title_id VARCHAR (5) CONSTRAINT FK_Employee_Job_title FOREIGN KEY REFERENCES Job_title (Job_title_id)

)

GO

 

INSERT INTO JOB_TITLE VALUES

('Office Clerical','512','Accounting Clerk','Computes classifies records verifies numerical accounting data records','No');

INSERT INTO JOB_TITLE VALUES

('Officials Managers','043','Assistant Store Manager','supervises coordinate worker activities assists store manager','Yes');

INSERT INTO JOB_TITLE VALUES

('Sales Worker','496','Bagger','places customer orders in bags and cart carryout','No');

INSERT INTO JOB_TITLE VALUES

('Sales Workers', '472','Cashier','operates cash register to total customer purchases','No');

INSERT INTO JOB_TITLE VALUES

('Technician', '104','Computer Support Specialist','updates computers & provides training technical assistance','Yes');

INSERT INTO JOB_TITLE VALUES

('Officials Managers','082','Director of Finance & Accounting','plans directs finance and accounting activities','Yes');

INSERT INTO JOB_TITLE VALUES

('Craft Workers', '780','Retail Asst. Bakery & Pastry','obtains prepares baked goods','No');

INSERT INTO JOB_TITLE VALUES

('Operatives', '781','Retail Asst. Butchers & Seafood Specialist','obtains prepares meat items','No');

INSERT INTO JOB_TITLE VALUES

('Office Clerical','562','Stocker','restocks merchandise displays','No');

INSERT INTO EMPLOYEE VALUES

('Edelman', 'Glenn', '175 Bishops Lane', 'La Jolla', 'CA','619', '555-0199', 'Sales Workers', '07-OCT-2003',21500.75, 'M', 64, '472');

INSERT INTO EMPLOYEE VALUES

('McMullen', 'Eric', '763 Church St', 'Lemon Grove', 'CA', '619', '555-0135', 'Sales Workers',' 1-NOV-2002', 13500.00, 'M', 20, '496');

INSERT INTO EMPLOYEE VALUES

('Slentz', 'Raj', '123 Torrey Dr', 'North Clairmont', 'CA', '619', '555-0123', 'Officials Managers', '1-JUN-2000', 48000.00, 'M', 34, '043');

INSERT INTO EMPLOYEE VALUES

('Broun', 'Erin', '2045 Parkway Apt 2B', 'Encinitas', 'CA', '760', '555-0100', 'Sales Workers', '12-MAR-2003', 10530.00, 'F', 24,'496');

INSERT INTO EMPLOYEE VALUES

('Carpenter', 'Donald','927 Second St', 'Encinitas', 'CA', '619', '555-0154', 'Office Clerical', '1-NOV-2003', 15000.00, 'M', 18, '562');

INSERT INTO EMPLOYEE VALUES

('Esquivez', 'David', '10983 N. Coast Hwy Apt 902', 'Encinitas', 'CA', '760', '555-0108', 'Operatives', '25-JUL-2003', 18500.00, 'M',25, '781');

INSERT INTO EMPLOYEE VALUES

('Sharp', 'Nancy', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '12-JUL-2003', 21000.00, 'F', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Chavez', 'Jose', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '19-NOV-2003', 16500.00, 'M', 19, '472');

INSERT INTO EMPLOYEE VALUES

('Chapman', 'Eden', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '13-SEP-2001', 17500.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Munoz', 'Luis', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '31-MAR-2001', 14500.00, 'M', 22, '512');

INSERT INTO EMPLOYEE VALUES

('Miller', 'Art', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-SEP-2003', 15000.00, 'M', 19, '512');

INSERT INTO EMPLOYEE VALUES

('Vance', 'Brent', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '29-MAR-2001', 10530.00, 'M', 22, '472');

INSERT INTO EMPLOYEE VALUES

('Sobkowiak', 'Gregg', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '17-DEC-2001', 10920.00, 'M', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Soper', 'Ken', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '16-APR-2003', 14500.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Sobota', 'Linzee', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '09-JUN-2002', 14000.00, 'F', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Spencer', 'Derea', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '11-APR-2003', 19500.00, 'M', 44, '472');

INSERT INTO EMPLOYEE VALUES

('Meier', 'Elaine', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '10-SEP-2000', 20500.00, 'F', 51, '472');

INSERT INTO EMPLOYEE VALUES

('Lopez', 'Margarita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '27-DEC-2001', 20000.00, 'F', 52, '472');

INSERT INTO EMPLOYEE VALUES

('Merz', 'Angie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '26-AUG-2000', 18000.00, 'F', 38, '472');

INSERT INTO EMPLOYEE VALUES

('Soukhone', 'Phanthousit', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '29-NOV-2002', 20500.00, 'M', 42, '472');

INSERT INTO EMPLOYEE VALUES

('Grayson', 'Mark', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '16-APR-2003', 18000.00, 'M', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Bruss', 'Isarel', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '08-MAY-2001', 19000.00, 'M', 22, '472');

INSERT INTO EMPLOYEE VALUES

('Bakker', 'George', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '10-FEB-2003', 18500.00, 'M', 19, '472');

INSERT INTO EMPLOYEE VALUES

('Bareman', 'Chris', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '06-FEB-2002', 19000.00, 'M', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Ball', 'David', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '22-AUG-2000', 20500.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Avery', 'Ledonna', '198 Governor Dr', 'Del Mar', 'CA', '619', '555-0135', 'Sales Workers', '28-MAR-2003', 21000.00, 'F', 23, '780');

INSERT INTO EMPLOYEE VALUES

('Tyink', 'Thomas', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '01-MAY-2001', 19000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Urtado', 'Larissa', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '05-FEB-2003', 19000.00, 'F', 35, '472');

INSERT INTO EMPLOYEE VALUES

('VanSlooten', 'Perry', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Crafts Workers', '12-DEC-2002', 19500.00, 'M', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Quintero', 'Martha', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Crafts Workers', '16-JUN-2003', 19500.00, 'F', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Quillian', 'Stan', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '16-DEC-1999', 23000.00, 'M', 29, '781');

INSERT INTO EMPLOYEE VALUES

('Rayder', 'Patrick', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '11-MAR-2002', 22500.00, 'M', 28, '781');

INSERT INTO EMPLOYEE VALUES

('Nitkowski', 'Aaron', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '20-JAN-2002', 21500.00, 'M', 32, '781');

INSERT INTO EMPLOYEE VALUES

('Lopez-Palma', 'Fran', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '28-MAR-2002', 20500.00, 'F', 27, '781');

INSERT INTO EMPLOYEE VALUES

('Lomax', 'Clay', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '27-NOV-2001', 20600.00, 'M', 28, '781');

INSERT INTO EMPLOYEE VALUES

('Grewell', 'Cyndi', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '14-MAY-2003', 21000.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Freeman', 'Gregory', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '14-MAY-2003', 19500.00, 'M', 31, '472');

INSERT INTO EMPLOYEE VALUES

('Garcia', 'Connie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '07-OCT-2001', 19500.00, 'F', 36, '472');

INSERT INTO EMPLOYEE VALUES

('Depree', 'Randy', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '07-DEC-1999', 34000.00, 'M', 40, '043');

INSERT INTO EMPLOYEE VALUES

('Cantu', 'Maria', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '03-MAR-2002', 37000.00, 'F', 45, '042');

INSERT INTO EMPLOYEE VALUES

('Chumakov', 'Fouay', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-AUG-2002', 40000.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Vasquez', 'Emestina', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '22-JUL-2000', 38000.00, 'F', 27, '472');

INSERT INTO EMPLOYEE VALUES

('Thompson', 'Erin', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-MAY-1999', 47367.00, 'F', 28, '472');

INSERT INTO EMPLOYEE VALUES

('Drohos', 'Craig', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '15-JUN-2000', 51000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Priest', 'Laurie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-JUN-1998', 67000.00, 'F', 34, '082');

INSERT INTO EMPLOYEE VALUES

('Stepka', 'Arthur', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '02-NOV-1999', 33000.00, 'M', 29, '472');

INSERT INTO EMPLOYEE VALUES

('Sams', 'Cecilia', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Professional', '25-SEP-2001', 35000.00, 'M', 31, '472');

INSERT INTO EMPLOYEE VALUES

('Wagner', 'Brenda', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-APR-1998', 60000.00, 'F', 44, '472');

INSERT INTO EMPLOYEE VALUES

('Santiago', 'Juanita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-DEC-2001', 33000.00, 'F', 29, '472');

INSERT INTO EMPLOYEE VALUES

('Rilley', 'Arlyn', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '24-OCT-2001', 33000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Pitcher', 'Daniel', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '25-JUN-1999', 50000.00, 'M', 35, '472');

INSERT INTO EMPLOYEE VALUES

('Reynolds', 'Yvonne', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '10-APR-1998', 70000.00, 'F', 42, '472');

INSERT INTO EMPLOYEE VALUES

('Vu', 'Matthew', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Technician', '16-AUG-2000', 37000.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Nguyen', 'Meredity', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Technician', '29-SEP-1998', 43000.00, 'F', 25, '472');

INSERT INTO EMPLOYEE VALUES

('Pighetti', 'Phillip', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '27-APR-2001', 24500.00, 'F', 27, '472');

INSERT INTO EMPLOYEE VALUES

('McNamara', 'Juanita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-OCT-1999', 25500.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Stephens', 'Harvey', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-MAR-1998', 75000.00, 'M', 51, '472');

Select * from employee

Select * from job_title

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where salary between 13000 and 45000

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where hire_date between '2000/01/01' and '2003/12/31'

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where telephone_area_code like '6%'

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where age like '2%'

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[New_table]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[New_table]

GO

select * into New_table from

(select eeo_1_class,job_title_id from employee

union

select eeo_1_class,job_title_id from job_title) A

 

select last_name from employee where eeo_1_class = 'sales workers'

select last_name from employee where salary > 30000

select last_name from employee where salary > 14000 and eeo_1_class = 'sales workers'

 

select last_name from employee join job_title on employee.job_title_id = job_title.job_title_id where salary > 20000 and exempt='yes'

Customer replied1339 days and 10 hours ago.

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[Employee]

GO

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Job_title]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[Job_title]

GO

 

CREATE TABLE JOB_TITLE

(

eeo_1_class VARCHAR (20) NOT NULL,

job_title_id VARCHAR (5) PRIMARY KEY,

job_title VARCHAR (50) NOT NULL,

job_descrip VARCHAR (100) NOT NULL,

exempt VARCHAR (4) NOT NULL

)

GO

CREATE TABLE EMPLOYEE

(

id_num INT IDENTITY (1, 1) PRIMARY KEY,

last_name VARCHAR (15) NOT NULL,

first_name VARCHAR(15) NOT NULL,

address VARCHAR (50) NOT NULL,

city VARCHAR (20) NOT NULL,

state VARCHAR (2) NOT NULL,

telephone_area_code VARCHAR (3) NOT NULL,

telephone_number VARCHAR (10) NOT NULL,

eeo_1_class VARCHAR (20) NOT NULL,

hire_date DATE NOT NULL,

salary DECIMAL (10,2),

gender CHAR(1) NOT NULL,

age INT NOT NULL,

job_title_id VARCHAR (5) CONSTRAINT FK_Employee_Job_title FOREIGN KEY REFERENCES Job_title (Job_title_id)

)

GO

 

INSERT INTO JOB_TITLE VALUES

('Office Clerical','512','Accounting Clerk','Computes classifies records verifies numerical accounting data records','No');

INSERT INTO JOB_TITLE VALUES

('Officials Managers','043','Assistant Store Manager','supervises coordinate worker activities assists store manager','Yes');

INSERT INTO JOB_TITLE VALUES

('Sales Worker','496','Bagger','places customer orders in bags and cart carryout','No');

INSERT INTO JOB_TITLE VALUES

('Sales Workers', '472','Cashier','operates cash register to total customer purchases','No');

INSERT INTO JOB_TITLE VALUES

('Technician', '104','Computer Support Specialist','updates computers & provides training technical assistance','Yes');

INSERT INTO JOB_TITLE VALUES

('Officials Managers','082','Director of Finance & Accounting','plans directs finance and accounting activities','Yes');

INSERT INTO JOB_TITLE VALUES

('Craft Workers', '780','Retail Asst. Bakery & Pastry','obtains prepares baked goods','No');

INSERT INTO JOB_TITLE VALUES

('Operatives', '781','Retail Asst. Butchers & Seafood Specialist','obtains prepares meat items','No');

INSERT INTO JOB_TITLE VALUES

('Office Clerical','562','Stocker','restocks merchandise displays','No');

INSERT INTO EMPLOYEE VALUES

('Edelman', 'Glenn', '175 Bishops Lane', 'La Jolla', 'CA','619', '555-0199', 'Sales Workers', '07-OCT-2003',21500.75, 'M', 64, '472');

INSERT INTO EMPLOYEE VALUES

('McMullen', 'Eric', '763 Church St', 'Lemon Grove', 'CA', '619', '555-0135', 'Sales Workers',' 1-NOV-2002', 13500.00, 'M', 20, '496');

INSERT INTO EMPLOYEE VALUES

('Slentz', 'Raj', '123 Torrey Dr', 'North Clairmont', 'CA', '619', '555-0123', 'Officials Managers', '1-JUN-2000', 48000.00, 'M', 34, '043');

INSERT INTO EMPLOYEE VALUES

('Broun', 'Erin', '2045 Parkway Apt 2B', 'Encinitas', 'CA', '760', '555-0100', 'Sales Workers', '12-MAR-2003', 10530.00, 'F', 24,'496');

INSERT INTO EMPLOYEE VALUES

('Carpenter', 'Donald','927 Second St', 'Encinitas', 'CA', '619', '555-0154', 'Office Clerical', '1-NOV-2003', 15000.00, 'M', 18, '562');

INSERT INTO EMPLOYEE VALUES

('Esquivez', 'David', '10983 N. Coast Hwy Apt 902', 'Encinitas', 'CA', '760', '555-0108', 'Operatives', '25-JUL-2003', 18500.00, 'M',25, '781');

INSERT INTO EMPLOYEE VALUES

('Sharp', 'Nancy', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '12-JUL-2003', 21000.00, 'F', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Chavez', 'Jose', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '19-NOV-2003', 16500.00, 'M', 19, '472');

INSERT INTO EMPLOYEE VALUES

('Chapman', 'Eden', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '13-SEP-2001', 17500.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Munoz', 'Luis', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '31-MAR-2001', 14500.00, 'M', 22, '512');

INSERT INTO EMPLOYEE VALUES

('Miller', 'Art', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-SEP-2003', 15000.00, 'M', 19, '512');

INSERT INTO EMPLOYEE VALUES

('Vance', 'Brent', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '29-MAR-2001', 10530.00, 'M', 22, '472');

INSERT INTO EMPLOYEE VALUES

('Sobkowiak', 'Gregg', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '17-DEC-2001', 10920.00, 'M', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Soper', 'Ken', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '16-APR-2003', 14500.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Sobota', 'Linzee', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '09-JUN-2002', 14000.00, 'F', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Spencer', 'Derea', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '11-APR-2003', 19500.00, 'M', 44, '472');

INSERT INTO EMPLOYEE VALUES

('Meier', 'Elaine', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '10-SEP-2000', 20500.00, 'F', 51, '472');

INSERT INTO EMPLOYEE VALUES

('Lopez', 'Margarita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '27-DEC-2001', 20000.00, 'F', 52, '472');

INSERT INTO EMPLOYEE VALUES

('Merz', 'Angie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '26-AUG-2000', 18000.00, 'F', 38, '472');

INSERT INTO EMPLOYEE VALUES

('Soukhone', 'Phanthousit', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '29-NOV-2002', 20500.00, 'M', 42, '472');

INSERT INTO EMPLOYEE VALUES

('Grayson', 'Mark', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '16-APR-2003', 18000.00, 'M', 21, '472');

INSERT INTO EMPLOYEE VALUES

('Bruss', 'Isarel', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '08-MAY-2001', 19000.00, 'M', 22, '472');

INSERT INTO EMPLOYEE VALUES

('Bakker', 'George', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '10-FEB-2003', 18500.00, 'M', 19, '472');

INSERT INTO EMPLOYEE VALUES

('Bareman', 'Chris', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '06-FEB-2002', 19000.00, 'M', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Ball', 'David', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '22-AUG-2000', 20500.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Avery', 'Ledonna', '198 Governor Dr', 'Del Mar', 'CA', '619', '555-0135', 'Sales Workers', '28-MAR-2003', 21000.00, 'F', 23, '780');

INSERT INTO EMPLOYEE VALUES

('Tyink', 'Thomas', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '01-MAY-2001', 19000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Urtado', 'Larissa', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Craft Workers', '05-FEB-2003', 19000.00, 'F', 35, '472');

INSERT INTO EMPLOYEE VALUES

('VanSlooten', 'Perry', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Crafts Workers', '12-DEC-2002', 19500.00, 'M', 24, '472');

INSERT INTO EMPLOYEE VALUES

('Quintero', 'Martha', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Crafts Workers', '16-JUN-2003', 19500.00, 'F', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Quillian', 'Stan', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '16-DEC-1999', 23000.00, 'M', 29, '781');

INSERT INTO EMPLOYEE VALUES

('Rayder', 'Patrick', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '11-MAR-2002', 22500.00, 'M', 28, '781');

INSERT INTO EMPLOYEE VALUES

('Nitkowski', 'Aaron', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '20-JAN-2002', 21500.00, 'M', 32, '781');

INSERT INTO EMPLOYEE VALUES

('Lopez-Palma', 'Fran', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '28-MAR-2002', 20500.00, 'F', 27, '781');

INSERT INTO EMPLOYEE VALUES

('Lomax', 'Clay', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Operatives', '27-NOV-2001', 20600.00, 'M', 28, '781');

INSERT INTO EMPLOYEE VALUES

('Grewell', 'Cyndi', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '14-MAY-2003', 21000.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Freeman', 'Gregory', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '14-MAY-2003', 19500.00, 'M', 31, '472');

INSERT INTO EMPLOYEE VALUES

('Garcia', 'Connie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Sales Workers', '07-OCT-2001', 19500.00, 'F', 36, '472');

INSERT INTO EMPLOYEE VALUES

('Depree', 'Randy', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '07-DEC-1999', 34000.00, 'M', 40, '043');

INSERT INTO EMPLOYEE VALUES

('Cantu', 'Maria', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '03-MAR-2002', 37000.00, 'F', 45, '042');

INSERT INTO EMPLOYEE VALUES

('Chumakov', 'Fouay', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-AUG-2002', 40000.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Vasquez', 'Emestina', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '22-JUL-2000', 38000.00, 'F', 27, '472');

INSERT INTO EMPLOYEE VALUES

('Thompson', 'Erin', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-MAY-1999', 47367.00, 'F', 28, '472');

INSERT INTO EMPLOYEE VALUES

('Drohos', 'Craig', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '15-JUN-2000', 51000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Priest', 'Laurie', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-JUN-1998', 67000.00, 'F', 34, '082');

INSERT INTO EMPLOYEE VALUES

('Stepka', 'Arthur', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '02-NOV-1999', 33000.00, 'M', 29, '472');

INSERT INTO EMPLOYEE VALUES

('Sams', 'Cecilia', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Professional', '25-SEP-2001', 35000.00, 'M', 31, '472');

INSERT INTO EMPLOYEE VALUES

('Wagner', 'Brenda', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-APR-1998', 60000.00, 'F', 44, '472');

INSERT INTO EMPLOYEE VALUES

('Santiago', 'Juanita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-DEC-2001', 33000.00, 'F', 29, '472');

INSERT INTO EMPLOYEE VALUES

('Rilley', 'Arlyn', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '24-OCT-2001', 33000.00, 'M', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Pitcher', 'Daniel', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '25-JUN-1999', 50000.00, 'M', 35, '472');

INSERT INTO EMPLOYEE VALUES

('Reynolds', 'Yvonne', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '10-APR-1998', 70000.00, 'F', 42, '472');

INSERT INTO EMPLOYEE VALUES

('Vu', 'Matthew', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Technician', '16-AUG-2000', 37000.00, 'M', 26, '472');

INSERT INTO EMPLOYEE VALUES

('Nguyen', 'Meredity', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Technician', '29-SEP-1998', 43000.00, 'F', 25, '472');

INSERT INTO EMPLOYEE VALUES

('Pighetti', 'Phillip', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '27-APR-2001', 24500.00, 'F', 27, '472');

INSERT INTO EMPLOYEE VALUES

('McNamara', 'Juanita', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Office Clerical', '29-OCT-1999', 25500.00, 'F', 32, '472');

INSERT INTO EMPLOYEE VALUES

('Stephens', 'Harvey', '10793 Montecino Rd', 'Ramona', 'CA', '858', '555-0135', 'Officials Managers', '01-MAR-1998', 75000.00, 'M', 51, '472');

Select * from employee

Select * from job_title

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where salary between 13000 and 45000

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where hire_date between '2000/01/01' and '2003/12/31'

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where telephone_area_code like '6%'

select * from employee join job_title on employee.job_title_id = job_title.job_title_id where age like '2%'

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[New_table]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

drop table [dbo].[New_table]

GO

select * into New_table from

(select eeo_1_class,job_title_id from employee

union

select eeo_1_class,job_title_id from job_title) A

 

select last_name from employee where eeo_1_class = 'sales workers'

select last_name from employee where salary > 30000

select last_name from employee where salary > 14000 and eeo_1_class = 'sales workers'

 

select last_name from employee join job_title on employee.job_title_id = job_title.job_title_id where salary > 20000 and exempt='yes'

Picture
Expert:  Raj replied1339 days and 9 hours ago.

Ok
I have got the database
Now can you please specify what all optrations are to be performed on what tables??

Customer replied1339 days and 9 hours ago.

Select employees' last names and group them by EEO-1 classification.

 

Select employees' last names and group them by salary.

 

Select employees' last names and group them by salary in their EEO-1 classification.

 

Select employees' last names and group them by salary in job titles, grouped into exempt and non-exempt.

Picture
Expert:  Raj replied1339 days and 9 hours ago.

You just need 4 Queries??

Customer replied1339 days and 9 hours ago.

I need those four queries, but I need to do the join table also

 

Use the database and tables to write SQL queries using Between, Like, and Union:

  • Write a SQL query that joins two tables in the example database and uses BETWEEN to restrict record selection. Use salary to restrict data.
  • Write a SQL query that joins two tables in the example database and uses BETWEEN to restrict record selection. Use hire dates to restrict data.
  • Write a SQL query that joins two tables in the example database and uses LIKE to restrict record selection. Use telephone area codes to restrict data.
  • Write a SQL query that joins two tables in the example database and uses LIKE to restrict record selection. Use age to restrict data.
  • Write a SQL query that uses the UNION of the two tables to produce a third table.

Or to verify what I have done is correct

 

Picture
Expert:  Raj replied1339 days and 9 hours ago.

First two Query are as follows:

select last_name,eeo_1_class from employee order by eeo_1_class

select last_name,salary from employee order by salary

Other two are confusing can you specify it in details

Customer replied1339 days and 9 hours ago.

I need to separate employees based on area codes

 

The other one I need to join the two tables and be able to restrict employees by age ranges

Picture
Expert:  Raj replied1339 days and 9 hours ago.

No i am talking about these:

Select employees' last names and group them by salary in their EEO-1 classification.

 

Select employees' last names and group them by salary in job titles, grouped into exempt and non-exempt.

Customer replied1339 days and 8 hours ago.

I see, I have 54 records and I need to list them all in the eeo class by salary

 

then all 54 records group by salary in their job title which should sort them by exempt or not.

 

did that help?

Picture
Expert:  Raj replied1339 days and 8 hours ago.

Just a second i am working on your JOIN Questions

Customer replied1339 days and 8 hours ago.

ok

Accepted Answer

Picture
Expert:  Raj replied1339 days and 8 hours ago.

Ok i am done with all codes for Join
here they are:


SELECT e.first_name,e.last_name,e.address,jt.job_title
FROM employee e JOIN job_title jt
ON e.job_title_id = jt.job_title_id
WHERE salary between 10000.00 AND 50000.00

SELECT e.first_name,e.last_name,e.address,jt.job_title
FROM employee e JOIN job_title jt
ON e.job_title_id = jt.job_title_id
WHERE hire_date between '01-JAN-2003' AND '31-DEC-2003'

Select * from employee

SELECT e.first_name,e.last_name,e.address,jt.job_title
FROM employee e JOIN job_title jt
ON e.job_title_id = jt.job_title_id
WHERE telephone_number LIKE '555-010_'

SELECT e.first_name,e.last_name,e.address,jt.job_title
FROM employee e JOIN job_title jt
ON e.job_title_id = jt.job_title_id
WHERE age LIKE '3_'


AND this last one was already done by you:

SELECT * INTO New_table FROM
(SELECT eeo_1_class,job_title_id FROM employee
UNION
SELECT eeo_1_class,job_title_id FROM job_title) A

Expert TypeComputer Engg.
Category: Programming
Pos. Feedback: 98.8 %
Accepts: 857
Answered: 10/18/2009

Experience: BE CS, 4+ Experience in Programming and Database (ERP)

Ask this Expert a Question >
 
Tweet

3 Programmers are Online Right Now

Ask Your Question Now
Programming Questions Date Submitted
Submit pseudocode and a flowchart for the following programming 6/10/2013
I would like to give a directory and then report on the extensions 6/9/2013
Can you help me with a programming assignment? 6/9/2013
I'm looking for someone to tutor me, for programming, and softwar 6/3/2013
hi there'i have four questions about java its all about 5/29/2013
For The Doctor ONLY - Please fix the Doe Valley town Meeting 5/18/2013
Scenario: 5/17/2013
I need help with my website, I put in the Infolink ad code 5/17/2013
I need to make the submit button bigger 5/15/2013
Need a java programming to fulfill the following requirements: 1. 5/13/2013
RSS
Next 10 >
Ask A Programmer
Type Your Programming Question Here...
characters left:

Top Programming Experts

See More Programmers

In The News

Nbc
Washington Post
New York Times
Cnn
Learn More

How It Works

  • Ask an Expert
  • Get a Professional Answer
  • Ask Followup Questions
  • 100% Satisfaction Guarantee
Learn More

Ask a Programmer

Get a Professional Answer. 100% Satisfaction Guaranteed.
120 Programmers are Online Now
Type Your Programming Question Here...
characters left:
Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Truste
Contact Us | Terms of Service | Privacy & Security | About Us | Our Network
© 2003-2013 JustAnswer LLC
  • Pearl.com
  • JustAnswer UK
  • JustAnswer Germany
  • JustAnswer Spanish
  • JustAnswer Japan