Create table as select

Create table as select trong Amazon Athena

  1. Thực hiện truy vấn câu query dưới đây.
CREATE  Table total_reviews
WITH (
format = 'PARQUET',
external_location = 's3://yourname-0000-datalake/parquet/total_reviews'
) 
AS
Select listings.name, count(reviews.review_id) as total_reviews
from 
listings 
inner join
reviews
on listings.listing_id=reviews.listing_id
group by listings.name;

Câu truy vấn này sẽ tạo ra một table mới có tên là total_reviews chứa thông tin tổng số reviews được thực hiện trên mỗi địa điểm Airbnb trong table listings. Dữ liệu của table này sẽ được Athena lưu tại location chúng ta chỉ định s3://yourname-0000-datalake/parquet/total_reviews .

DataLake