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

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Clusterpoint wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Relational algebra wikipedia , lookup

SQL wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

Object-relational impedance mismatch wikipedia , lookup

Database model wikipedia , lookup

Transcript
Write a SQL query that joins two tables in the example database and uses
BETWEEN to restrict record selection. (Use salary to restrict the data.)
choose * from employee join job_title on employee.job_title_id =
job_title.job_title_id where salary between 15000 and 25000
Write a SQL query that joins two tables in the example database and uses
BETWEEN to restrict record selection. (Use hire dates to restrict the data.)
choose * from employee join job_title on employee.job_title_id =
job_title.job_title_id where hire_date between '2003/03/12' and '2003/07/12'
·
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.)
choose * from employee join job_title on employee.job_title_id =
job_title.job_title_id where telephone_area_code like '7%'
Write a SQL query that joins two tables in the example database and uses LIKE
to restrict record selection. (Use age to restrict data.)
choose * from employee join job_title on employee.job_title_id =
job_title.job_title_id where age like '1%'
·
Write a SQL query that uses UNION of the two tables to produce a third table.
In case 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
choose * into New_table from
(select eeo_1_classification,job_title_id from employee
union
choose eeo_1_classification,job_title_id from job_title) A
Print out each query and its results along with storing them on a removable disk
to use for a demonstration in class. Get ready to show your queries in class.