How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Raj Your Own Question

Raj
Raj, Computer Engg.
Category: Programming
Satisfied Customers: 1259
Experience:  BE CS, 4+ Experience in Programming and Database (ERP)
16752232
Type Your Programming Question Here...
Raj is online now
A new question is answered every 9 seconds

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

Resolved 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.
Submitted: 4 years ago.
Category: Programming
Expert:  Raj replied 4 years ago.
Can i have a look at the database to be used??
Customer: replied 4 years 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: replied 4 years 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'

Expert:  Raj replied 4 years ago.
Ok
I have got the database
Now can you please specify what all optrations are to be performed on what tables??
Customer: replied 4 years 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.

Expert:  Raj replied 4 years ago.
You just need 4 Queries??
Customer: replied 4 years 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

 

Expert:  Raj replied 4 years 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: replied 4 years 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

Expert:  Raj replied 4 years 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: replied 4 years 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?

Expert:  Raj replied 4 years ago.
Just a second i am working on your JOIN Questions
Customer: replied 4 years ago.
ok
Expert:  Raj replied 4 years 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
Raj, Computer Engg.
Category: Programming
Satisfied Customers: 1259
Experience: BE CS, 4+ Experience in Programming and Database (ERP)
Raj and other Programming Specialists are ready to help you

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)