Tải bản đầy đủ (.pdf) (3 trang)

Đề trắc nghiệm lập trình C

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (22.21 KB, 3 trang )

Chapter 10

Exercises

1. alter table service
add constraint Default_Servicename default 'First Aid' for service_name

2. create rule check_servicecode
as @scode in ('CC', 'N', 'WC')
go
sp_bindrule 'check_servicecode', 'airline_service.service_code'

3. alter table airlines_master
add constraint PK_aircode primary key (aircode)
insert into airlines_master values (NULL, 'Cathay Pacific')

4. alter table Flight_days
add constraint chk_daycode check (day_code between 1 and 7)

5. alter table airline_meal
add constraint FK_aircode
foreign key (aircode) references airlines_master (aircode)

6. create clustered index citycode_ndx on city_master (city_code)

7. create index pnrno_tktno_ndx
on passenger (pnr_no, ticket_no)
with pad_index, fillfactor=75

OR


create nonclustered index pnrno_tktno_ndx
on passenger (pnr_no, ticket_no)
with pad_index, fillfactor=75
8. sp_helpindex airlines_master

Chapter 11

Check Your Progress

1. The first statement creates a temporary table that occupies storage space. The second
statement creates a view that does not occupy any storage space.

2.
False
5.
c, d
3.
c
6.
True
4.
c, d
7.
linked servers




Chapter 12


Exercises

1. create view pass_view as
select r.pnr_no, aircraft_code, ticket_no, name, status
from reservation r inner join passenger p
on r.pnr_no=p.pnr_no
where r.pnr_no < 4
with check option

2. select * from pass_view

3. update pass_view
set name = 'Pam Houston'
where ticket_no=3
select name from passenger where ticket_no=3

4. create view weekend_flights as
select * from flight_days where day_code=1 or day_code=7

5. delete weekend_flights
where aircraft_code='AI03' and day_code=7
select * from flight_days
where aircraft_code='AI03' and day_code=7

6. alter view pass_view with schemabinding as
select r.pnr_no, aircraft_code, ticket_no, name, status
from dbo.reservation r inner join dbo.passenger p
on r.pnr_no=p.pnr_no
where r.pnr_no < 4
with check option


7. create unique clustered index name_ndx
on pass_view (name)

sp_spaceused pass_view
go
sp_spaceused weekend_flights

8. create table CC_table
( aircode char(2),
service_code varchar(3) check (service_code='CC')
constraint pk_cc primary key (aircode, service_code))
insert into CC_table
select * from airline_service where service_code='CC'

create table WC_table
( aircode char(2),
service_code varchar(3) check (service_code='WC')
constraint pk_wc primary key (aircode, service_code))
insert into WC_table
select * from airline_service where service_code='WC'

create table N_table
( aircode char(2),
service_code varchar(3) check (service_code='N')
constraint pk_n primary key (aircode, service_code))
insert into N_table
select * from airline_service where service_code='N'

9. create view all_services as

select * from cc_table
union all
select * from wc_table
union all
select * from n_table

10. insert into all_services values ('CP', 'CC')
select * from cc_table where aircode=‘CP’ and service_code=‘CC’

×