Lecture 12 - Database Transactions

Lecture 12 - Database Transactions - Additional Database...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Additional Database Operations More SQL commands Table Joins Database Transactions
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Some Built-in Functions SUM() = Adds the values of the columns MAX() = Maximum MIN() = Minium COUNT() = Number of records/results
Background image of page 2
Consider the table vehicle TYPE COLOR COUNT PRICE Truck Blue 5 650 Sedan Red 4 500 Plane Blue 3 3000 Bike Red 6 20 SELECT COUNT(*) FROM vehicle 4 SELECT SUM(price) FROM vehicle 4170 SELECT MIN(price) FROM vehicle 20 SELECT MAX(price) FROM vehicle 3000
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Operations TYPE COLOR COUNT PRICE Truck Blue 5 650 Sedan Red 4 500 Plane Blue 3 3000 Bike Red 6 20 SELECT TYPE, count*price FROM vehicle Truck 3250 Sedan 2000 Plane 9000 Bike 120
Background image of page 4
GROUP By TYPE COLOR COUNT PRICE Truck Blue 5 650 Sedan Red 4 500 Plane Blue 3 3000 Bike Red 6 20 SELECT COLOR, sum(count) FROM vehicle GROUP by COLOR Blue 8 Red 10
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
GROUP By TYPE COLOR COUNT PRICE Truck Blue 5 650 Sedan Red 4 500 Plane Blue 3 3000 Bike Red 6 20 SELECT COLOR, sum(count) FROM vehicle WHERE count > 3 GROUP by COLOR Blue 5 Red 10
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

Lecture 12 - Database Transactions - Additional Database...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online