English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am using a database for my work which has information on cars, and the first four questions are like : Do you hav any 5 doors cars, which are blue or red?

And the last 2 questions are like:

Have you any 5 door cars, which are blue or red, made by Ford?

All help is very much appreciated

2007-03-03 03:54:44 · 2 answers · asked by terminator_3000 1 in Computers & Internet Programming & Design

2 answers

SELECT * FROM cars WHERE color LIKE 'blue' AND doors = 5 OR SELECT * FROM cars WHERE color LIKE 'red' AND doors = 5

The SQL KEYWORDS are in CAPS. The asterisk (*) is a wildcard character. You can also do

SELECT cars.make, cars.model, cars.year WHERE ... and select specific fields from the table that way.

For a great Access/SQL book, check out "Learning SQL: A Step-by-Step Guide Using Access" by Bagui and Earp

(ISBN # 0-321-011904-5). I have linked to the Amazon page for this book in the sources section.

2007-03-03 04:51:19 · answer #1 · answered by Richard H 7 · 0 0

Go into the SQL window and enter something like...

select * from cars
where number_of_doors=5
and (color="RED" or color="BLUE")


and

select * from cars
where number_of_doors=5
and (color="RED" or color="BLUE")
and maker="Ford"

For your work or school? :)

2007-03-03 11:58:15 · answer #2 · answered by BigRez 6 · 0 0

fedest.com, questions and answers