Lab 10
Lab 10
--Cau 2
SELECT *
FROM actor
where first_name like "N%";
SELECT *
FROM actor
where first_name like "%N%";
--Cau 3
CREATE UNIQUE INDEX `idx_customer_email` ON `sakila`.`customer` (email);
--Tra loi: khi them unique vao email thi se khong the them email trung, neu them se
hien loi nhu sau
--Duplicate entry '[email protected]' for key
'customer.idx_customer_email'
--Cau 4
CREATE INDEX `idx_film_description` ON `sakila`.`film` (description(255));
select *
from film
where description like 'A Boring%';
--Cau 5
CREATE INDEX `idx_rental_rental_date` ON `sakila`.`rental` (rental_date);
SELECT *
FROM rental
where year(rental_date) = 2005 and month(rental_date) = 5;
--Tra loi: Index khong duoc su dung do tep du lieu lon nhu hinh anh VD