Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
547 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | SQL (203 exercises) |
Topic ==> | Setting criteria using WHERE (12 exercises) |
Level ==> | Average difficulty |
Subject ==> | SQL training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
This will generate the database that you'll need to use in order to do this exercise (note that the database and script are only to be used for exercises published on this website, and may not be reused or distributed in any form without the prior written permission of Wise Owl).
Create a query which lists out all of the events which took place in February 2005:
Your query should return these two events.
To put it another way, list out all the events which took place between 1st February 2005 and 28th February 2005.
Save this query as February 2005, then close it down.
You can find other training resources for the subject of this exercise here:
From: | amoVolando |
When: | 16 Jun 23 at 06:22 |
Select EventName ,EventDate from tblEvent
Where Eventdate like '2005-02-__'
From: | FadwaEgypt |
When: | 23 Oct 21 at 16:18 |
select * from tblEvent
where Year(EventDate) = 2005 and MONTH(EventDate) = 2
select * from tblEvent
where EventDate between '2005-02-01' and '2005-02-28'
From: | ahmed yousif |
When: | 23 Oct 20 at 10:33 |
select EventName as what,EventDate as 'when'
from dbo.tblEvent
where EventDate >= '20050201'
and EventDate <= '20050228'
From: | GRSB3 |
When: | 22 Nov 19 at 13:21 |
--1st
SELECT *
FROM
tblEvent
WHERE EventDate LIKE '2005-02%'
--2nd
SELECT *
FROM
blEvent
WHERE EventDate BETWEEN '2005-02-01' AND '2005-02-28'
From: | Andy B |
When: | 22 Nov 19 at 14:36 |
Use the YEAR function for an even easier way ...
From: | GRSB3 |
When: | 26 Nov 19 at 16:00 |
SELECT *
FROM tblEvent
WHERE Year(EventDate) = '2005' AND Month(EventDate) = '2'
SELECT *
FROM tblEvent
WHERE Year(EventDate) = '2005'
AND Month(EventDate) = '2'
AND DAY(EventDate) BETWEEN '1' AND '28'
From: | Andy B |
When: | 26 Nov 19 at 16:05 |
Better - but you shouldn't put the inverted commas round the numbers, as they aren't text!
From: | maryam |
When: | 27 Jul 18 at 19:57 |
select *
from [dbo].[tblEvent]
where DATEPART(yyyy, EventDate) = 2005 and
DATEPART(month, EventDate) = 2
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2024. All Rights Reserved.