• Non ci sono risultati.

DBG Queries in relational algebraTania Cerquitelli Relational algebra

N/A
N/A
Protected

Academic year: 2021

Condividi "DBG Queries in relational algebraTania Cerquitelli Relational algebra"

Copied!
7
0
0

Testo completo

(1)

DB M G

Relational algebra

Queries in relational algebra

Tania Cerquitelli

(2)

DB M G

Exercise n. 1

Find the codes of patient that have bought at least two drugs of the same category in the same day.

DRUG (DrugCode, DrugName, Category)

PATIENT (PatientCode, PatientName, BirthDate) DOCTOR(DoctorCode, DoctorName)

SALE(DrugCode, PatientCode, Date, DoctorCode, Quantity, Amount)

(3)

DB M G

(4)

DB M G

Exercise n. 2

Find the codes of customers that reserved only resorts located in their country.

CUSTOMER (CustCode, CustName, Gender, AgeRange, CustCountry) VACATION-RESORT (ResCode, ResName, ResType, Location, ResCountry)

RESERVATION(CustCode, StartDate, EndDate, ResCode)

(5)

DB M G

(6)

DB M G

Exercise n. 3

Show the code and name of products of the “Puma” brand that have been on sale at least twice in the same shop with a discount higher than 60%.

PRODUCT(PCode, PName, Brand, Price) SHOP(SCode, SName, DateOpening, City)

SALE(PCode, SCode, SaleStartDate, Duration, DiscountPercentage)

(7)

DB M G

Riferimenti

Documenti correlati

Find the codes of the sailors who have never booked a red boat SAILOR (SId, SName, Expertise, DateofBirth). BOOKING (SId, BId, Date) BOAT(Bid,

SELECT DISTINCT PersonName FROM LEASING_CONTRACT LC GROUP BY PersonNamem, FCode HAVING COUNT(*)>2.. FLAT (FCode, Address,

TOUR-GUIDE (GuideCode, Name, Surname, Nationality) TYPE-OF-TOUR (TourTypeCode, Monument, Duration, City) GROUP (GroupCode, NumberOfParticipants, Language)..

TOUR-GUIDE (GuideCode, Name, Surname, Nationality) TYPE-OF-TOUR (TourTypeCode, Monument, Duration, City) GROUP (GroupCode, NumberOfParticipants, Language)..

Cooking type and size are known for pots, while blade length and breadth are known for knifes... DB

• HBase™: A scalable, distributed database that supports structured data storage for large tables. • Hive™: A data warehouse infrastructure that provides data summarization and

Specialized storage solutions, e.g, document- based, key-value pairs, graph databases, columnar storage.. Predefined schema for each table, changes allowed but usually

- A relational database is a collection of tables of data, each of which has one special column that stores the primary keys of the table.. - Rows are sometimes