Sunteți pe pagina 1din 12

Homework Assignment 3

NAME: PAUL GUDGEL

SECTION: BCIS 4660: DAY 001

Spring 2018
TAL 3-10
Give the item number, description, and on-hand value for each item in category GME.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

SELECT Item.[ItemNum], Item.[Description], Item.[OnHand]


FROM Item
WHERE (((Item.Category)="GME"));
TAL 3-12
List all columns and all rows in the item table. Sort the results by item number within category.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW
SELECT Item.[Category], Item.[ItemNum], Item.[Description], Item.[OnHand], Item.[Storehouse], Item.[Price], Item.[OnHand Value]
FROM Item
ORDER BY Item.[Category], Item.[ItemNum];
TAL 3-14
Create a new table named Toy to contain the columns ItemNum, Description, OnHand, and Price for all rows on which the category is
TOY.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

SELECT Item.ItemNum, Item.Description, Item.OnHand, Item.Price INTO Toy


FROM Item
WHERE (((Item.Category)="TOY"));
TAL 3-15
In the Toy table, change the description of item DL51 to “Classic Train Set”.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

UPDATE Toy SET Toy.[Description] = "Classic Train Set"


WHERE (((Toy.[ItemNum])="DL51"));
TAL 3-16
In the Toy table, delete every row on which the price is greater than $120.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

DELETE Toy.[ItemNum], Toy.[Description], Toy.[OnHand], Toy.[Price]


FROM Toy
WHERE (((Toy.[Price])>120));
CAT 3-10
How many reservations include a trip with a price that is greater than $20 but less than $75?

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

SELECT Reservation.[TripID], Reservation.[TripPrice]


FROM Reservation
WHERE (((Reservation.[TripPrice])>20 And (Reservation.[TripPrice])<75));
CAT 3-11
List the reservation ID, customer last name, and the trip name for all reservations where the number of persons included in the
reservation is greater than four.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW
SELECT Reservation.ReservationID, Customer.LastName, Trip.TripName
FROM Trip INNER JOIN (Customer INNER JOIN Reservation ON Customer.[CustomerNum] = Reservation.[CustomerNum]) ON Trip.[TripID] = Reservation.[TripID]
WHERE (((Reservation.NumPersons)>4));
CAT 3-14
List the reservation ID, trip name, customer’s last name, customer's first name, and total cost for all reservations where the number of
persons is grater than four. Use the column name TotalCost for the calculated field.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW
SELECT Reservation.ReservationID, Customer.LastName, Customer.FirstName, Trip.TripName, Reservation.TotalCost
FROM Trip INNER JOIN (Customer INNER JOIN Reservation ON Customer.[CustomerNum] = Reservation.[CustomerNum]) ON Trip.[TripID] = Reservation.[TripID]
WHERE (((Reservation.NumPersons)>4));
CAT 3-15
Create a new table named Solo that includes the reservation ID, trip ID, trip date, trip price, other fees, and customer number for all
reservations that are only for one person.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW
SELECT Reservation.[ReservationID], Reservation.[TripID], Reservation.[TripDate], Reservation.[TripPrice], Reservation.[OtherFees], Reservation.[CustomerNum]
INTO Solo
FROM Reservation
WHERE (((Reservation.NumPersons)=1));
CAT 3-16
Use an update query to change the OtherFees value in the solo table to $5.00 for all records on which the OtherFees value is $0.00.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

UPDATE Solo SET Solo.[OtherFees] = 5


WHERE (((Solo.[OtherFees])=0));
CAT 3-17
Use a delete query to delete all trips ion the Solo table where the trip date is 9/12/116.

DATASHEET VIEWS QUERY DESIGN/QBE VIEW

SQL VIEW

DELETE Solo.[ReservationID], Solo.[TripID], Solo.[TripDate], Solo.[TripPrice], Solo.[OtherFees], Solo.[CustomerNum]


FROM Solo
WHERE (((Solo.[TripDate])=#9/12/2016#));