wiki:UseCase4

Приказ на детали

Посетител може да гледа детали за избраниот бизнис.

Актери

  • Посетител

Реализација

Чекор 1 : Корисникот го избира копчето Бизниси од главното мени.

Чекор 2 : Се листаат сите бизниси кои постојат во базата.

select
        b.business_id,
        b.business_name,
        (
        select
                avg(r.review_stars)
        from
                review r
        where
                r.business_id = b.business_id
                                ) as business_avg_stars,
        c.category_id,
        c.category_name,
        (
        select
                string_agg(a.address_city, '; ') as address_city
        from
                address a
        where
                a.business_id = b.business_id
                                ) as address_city
from
        business b
join category c on
        b.category_id = c.category_id
order by
        b.business_name

Чекор 3 : Корисникот избира бизнис со кликнување на него. Системот го прикажува избраниот бизнис.

Најди детали за бизнисот

select
        b.business_name,
        (
                select avg(r.review_stars)
                from review r
                where r.business_id = b.business_id
        ) as business_avg_stars,
        c.category_name,
        b.business_hours,
        b.business_descr,
        b.business_phone
from
        business b
join category c on
        b.category_id = c.category_id
where
        b.business_id = 4

Најди ги сите сервиси за бизнисот

select
        string_agg(s.service_name, '; ') as services
from
        business_service bs
join service s on
        bs.service_id = s.service_id
where business_id = 4

Најди ги сите адреси на бизнисот.

select
        address_id,
        address_street,
        address_postal_code,
        address_city
from address
where business_id = 4

Најди ги сите ревјуа за бизнисот

select
        r.reviewer_name,
        r.reviewer_verified,
        rv.review_title,
        rv.review_text,
        rv.review_stars,
        rv.address_id
from review rv
join reviewer r on
        rv.reviewer_id = r.reviewer_id
where
        rv.business_id = 4
Last modified 3 years ago Last modified on 01/24/22 16:55:55

Attachments (4)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.