Re: Indexes
Posted in 1997
In article <5dvppk$77q@cssun.mathcs.emory.edu>, Susik Lee
<susikl@skechers.com> writes
>If I have following table:
> table A customer char(10),
> inv_num int,
> bill_data date,
> ship_date date,
> bill_amt real,
> print_flag char(1)
>
> cust_index on (customer)
> cust_index2 on (customer, inv_num)
> cust_index3 on (bill_date)
>
>Question 1:
> select count(*) from A where customer = "1111" and print_flag <> "A">
> How does on-line search table A? Will it get all the records from
>table A where customer = "1111" using index, than search records base on
>print_flag within these records? For example: We have 200,000 records in
Yes, it reads down the levels of the index and then along the list of
rows wiht the same index keys.
>table A and 50 records with customer = "1111". Will the above select
>statement will get 50 records from table than search base on print_flag on
>these 50 records only?.
>
>Question 2:
> select count(*) from A where customer = "1111" and bill_date = "10/1/96">
> Will about sql will use cust_index and cust_index3 to get records?
>Or do I need to create new index on (customer, bill_date)?
Create a new index.
>
>Thanks
>
>-----
> Susik Lee
> Skechers USA
> email: susikl@skechers.com
> phone: (310) 318-3100x1285
>
--
David Williams