
















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Some concept of Database Management Systems are Access Methods Layer, Basic Structure, Common Structures, Designing Systems, Join Processing, Modern Computers, Query Evaluation Techniques. Main points of this lecture are: Basic Structure, Query Language, Structure, Basic Structure, Columns, Tables, Write Queries, Basic Query, Performed, Multiple Tables
Typology: Slides
1 / 56
This page cannot be seen from the preview
Don't miss anything!
1
2
4
5
CustomerID LastName FirstName Phone
Customer SaleID SaleDate CustomerID
Sales
CustomerID LastName FirstName Phone 1 Jones Mary 111- 2 Smith Marta 222- 3 Jackson Miguel 444- 4 Smith Mark 555-
SaleID SaleDate CustomerID 1 5/1 1 2 5/1 2 3 5/2 4 4 5/2 1
SaleID SaleDate CustomerID CustomerID LastName FirstName Phone
1 5/1 1 1 Jones Mary 111-
2 5/1 2 2 Smith Marta 222-
3 5/2 4 4 Smith Mark 555-
4 5/2 1 1 Jones Mary 111-
7
SupplierID Name ContactName Phone Address ZipCode CityID
Supplier
PONumber OrderDate ReceiveDate SupplierID EmployeeID ShippingCost
Merchandise Order
OrderID OrderDate ReceiveDate SupplierID ShippingCost EmployeeID
AnimalOrder OrderID AnimalID Cost
Animal OrderItem
CityID ZipCode City State AreaCode Population Population Country Latitude Longitude
City
EmployeeID LastName FirstName Phone Address ZipCode CityID TaxPayerID DateHired DateReleased
Employee
PONumber ItemID Quantity Cost
OrderItem
Category Registration
Category
Category Breed
Breed
AnimalID Name Category Breed DateBorn Gender Registered Color ListPrice Photo
Animal
SaleID SaleDate EmployeeID CustomerID SalesTax
Sale
SaleID ItemID Quantity SalePrice
SaleItem
ItemID Description QuantityOnHand ListPrice Category
Merchandise
SaleID AnimalID SalePrice
SaleAnimal
CustomerID Phone FirstName LastName Address ZipCode CityID
Customer
8
10
Query04_Fig
11
SELECT columns What do you want to see?
FROM tables What tables are involved?
JOIN conditions How are the tables joined?
WHERE criteria What are the constraints?
13
SELECT Category
FROM Animal;
Category Fish Dog Fish Cat Cat Dog Fish Dog Dog Dog Fish Cat Dog
...
SELECT DISTINCT Category FROM Animal;
Category Bird Cat Dog Fish Mammal Reptile Spider
Which dogs have a list price greater than $250?.
14
Query04_Fig
16
a b a AND b a OR b T T T T
T F F T F T F T
F F F F
a = 3
b = -
c = 2
(a > 4) Or (b < 0)
F T F
(a > 4) And (b < 0)
F T T
NOT (b < 0)
T F
17
F T F T
( (a > 4) AND (b < 0) ) OR (c > 1) T
T
F T
F F
(a > 4) AND ( (b < 0) OR (c > 1) ) T
T
a = 3
b = -
c = 2
The result is affected by the order of the operations. Parentheses indicate that an operation should be performed first. With no parentheses, operations are performed left-to-right.
Always use parentheses,
so other people can read
and understand your query.
19
T F
T F
NOT ((Registered is NOT NULL) OR (Color LIKE ‘%Red%’))
Registered=ASCF Color=Black
(Registered is NULL) AND NOT (Color LIKE ‘%Red%’)
F T
F
or
not
and
not^ F
20
Query04_Fig