Assignment week 2
1. a, SELECT Writer from Books Where Writer like
'J*'
If I want find all writers with names that starts on J
Fråga5
|
JRR. Tolkien
|
|
James Branch Cabell
|
1. b, SELECT Writers from Books Where Writer not like
'J*'
If I want to find all writers with names that not starts
with J.
Fråga6
|
Kurt Vonnegut Jr.
|
|
Ray Bradbury
|
|
Erskine Caldwell
|
|
Peter Freuchen
|
|
Lars Molin
|
|
Mind and Nature
|
2. SELECT Title from Books Where Item in (1, 2,
5)
If I want to find Books with the keys 1, 2 and 5.
Fråga12
|
Slaughter House 5
|
|
Death is a lonely business
|
|
Figures of Earth
|
SELECT Title from Books Where Item not in (1, 2,
5)
I I want find books that not have the keys 1,2 and 3.
Fråga16
|
Tobacco Road
|
|
Silmarillion
|
|
Larions Law
|
|
The Cross
|
|
Mind and Nature
|
|
Venus on the Half-Shell
|
|
Great Expectations
|
3. SELECT * from Books Where PublishingDate between
#1969-01-01# and #1985-12-31#
If I want to find books with a publishing date between
1969--1985-12-31.
Fråga8
|
1
|
Slaughter House 5
|
Kurt Vonnegut Jr.
|
1969-01-01
|
1000000
|
1000000
|
20
|
5
|
|
2
|
Death is a lonely business
|
Ray Bradbury
|
1985-05-05
|
2000000
|
2000000
|
40
|
7
|
|
4
|
Silmarillion
|
JRR. Tolkien
|
1979-01-02
|
3000000
|
3000000
|
15
|
2
|
|
5
|
Figures of Earth
|
James Branch Cabell
|
1974-01-01
|
500000
|
500000
|
15
|
3
|
|
6
|
Larions Law
|
Peter Freuchen
|
1981-01-01
|
300000
|
300000
|
20
|
5
|
4.A. SELECT Title from Books Where Cost between 3 and
10
IF I want to know what titles that have a produktion cost
between 3 and 10
Fråga9
|
Slaughter House 5
|
|
Death is a lonely business
|
|
Tobacco Road
|
|
Figures of Earth
|
|
Larions Law
|
4.B. SELECT Cost, Title from Books Where [Cost] >
10 OR [Cost] < 20
If I want to know the title of books with a production cost
between 10 and 20 and the production cost of these books
Fråga13
|
5
|
Slaughter House 5
|
|
7
|
Death is a lonely business
|
|
3
|
Tobacco Road
|
|
2
|
Silmarillion
|
|
3
|
Figures of Earth
|
|
5
|
Larions Law
|
|
2
|
The Cross
|
|
0
|
Mind and Nature
|
5.A. INSERT into Books Values(9, 'Venus on the
Half-Shell', 'Kilgore Trout', 1975-05-26, 1000000, 1000000,
25, 4)
I want to insert the values about the book Venus on the
Half-Shell by Kilgore Trout
Fråga14
|
1
|
Slaughter House 5
|
Kurt Vonnegut Jr.
|
1969-01-01
|
1000000
|
1000000
|
20
|
5
|
|
2
|
Death is a lonely business
|
Ray Bradbury
|
1985-05-05
|
2000000
|
2000000
|
40
|
7
|
|
3
|
Tobacco Road
|
Erskine Caldwell
|
1932-02-02
|
500000
|
500000
|
20
|
3
|
|
4
|
Silmarillion
|
JRR. Tolkien
|
1979-01-02
|
3000000
|
3000000
|
15
|
2
|
|
5
|
Figures of Earth
|
James Branch Cabell
|
1974-01-01
|
500000
|
500000
|
15
|
3
|
|
6
|
Larions Law
|
Peter Freuchen
|
1981-01-01
|
300000
|
300000
|
20
|
5
|
|
7
|
The Cross
|
Lars Molin
|
1905-05-31
|
100000
|
98000
|
30
|
2
|
|
8
|
Mind and Nature
|
Gregory Bateson
|
|
0
|
0
|
0
|
0
|
|
9
|
Venus on the Half-Shell
|
Kilgore Trout
|
1975-05-26
|
1000000
|
1000000
|
25
|
4
|
5.B. INSERT into Books
([Title],[Writer],[PublishingDate]) Values('Great
Expectations','Charles Dickens',1860-01-01)
I want to insert Title, Writer and Publishing date
Fråga 15
|
1
|
Slaughter House 5
|
Kurt Vonnegut Jr.
|
1969-01-01
|
1000000
|
1000000
|
20
|
5
|
|
2
|
Death is a lonely business
|
Ray Bradbury
|
1985-05-05
|
2000000
|
2000000
|
40
|
7
|
|
3
|
Tobacco Road
|
Erskine Caldwell
|
1932-02-02
|
500000
|
500000
|
20
|
3
|
|
4
|
Silmarillion
|
JRR. Tolkien
|
1979-01-02
|
3000000
|
3000000
|
15
|
2
|
|
5
|
Figures of Earth
|
James Branch Cabell
|
1974-01-01
|
500000
|
500000
|
15
|
3
|
|
6
|
Larions Law
|
Peter Freuchen
|
1981-01-01
|
300000
|
300000
|
20
|
5
|
|
7
|
The Cross
|
Lars Molin
|
1905-05-31
|
100000
|
98000
|
30
|
2
|
|
8
|
Mind and Nature
|
Gregory Bateson
|
|
0
|
0
|
0
|
0
|
|
9
|
Venus on the Half-Shell
|
Kilgore Trout
|
1975-05-26
|
1000000
|
1000000
|
25
|
4
|
|
11
|
Great Expectations
|
Charles Dickens
|
1860-01-01
|
0
|
0
|
0
|
0
|
The table summary="SQL"
Books
|
Item
|
Title
|
Writer
|
PublishingDate
|
Sold
|
Printed
|
Price
|
Cost
|
|
1
|
Slaughter House 5
|
Kurt Vonnegut Jr.
|
1969-01-01
|
1000000
|
1000000
|
20
|
5
|
|
2
|
Death is a lonely business
|
Ray Bradbury
|
1985-05-05
|
2000000
|
2000000
|
40
|
7
|
|
3
|
Tobacco Road
|
Erskine Caldwell
|
1932-02-02
|
500000
|
500000
|
20
|
3
|
|
4
|
Silmarillion
|
JRR. Tolkien
|
1979-01-02
|
3000000
|
3000000
|
15
|
2
|
|
5
|
Figures of Earth
|
James Branch Cabell
|
1974-01-01
|
500000
|
500000
|
15
|
3
|
|
6
|
Larions Law
|
Peter Freuchen
|
1981-01-01
|
300000
|
300000
|
20
|
5
|
|
7
|
The Cross
|
Lars Molin
|
1905-05-31
|
100000
|
98000
|
30
|
2
|
|
8
|
Gregory Bateson
|
Mind and Nature
|
|
0
|
0
|
0
|
0
|
I use auotnumbers and the date is a bit different in
Sweden