04-10-2011, Slides of Database Management Systems (DBMS)

guria rani 09

Typology: Slides

2011/2012

Uploaded on 08/12/2012

guriarani09
guriarani09 🇵🇰

4.3

(3)

25 documents

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Slide 1
WCC
Database Management System
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download 04-10-2011 and more Slides Database Management Systems (DBMS) in PDF only on Docsity!

  • Slide

Slide 2

The SUM() function returns the average

value of a numeric column.

The SUM() Function SELECT SUM(column_name) FROM table_name

Slide 4

OrderTotal

SELECT SUM(OrderPrice) AS OrderTotal FROM Orders;

Slide 5 Aggregate functions often need an added GROUP BY statement The GROUP BY Statement SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name; GROUP BY statement is used in conjunction with the aggregate functions to group the result-set by one or more columns

Slide 7 Customer SUM(OrderPrice) Saqib 3600 Umer 1700 Waqas 400 SELECT Customer, SUM(OrderPrice) FROM Orders GROUP BY Customer;

Slide 8

Let's see what happens if

we omit the GROUP BY

statement:

Slide 10 Customer SUM(OrderPrice) Saqib 5700 Umer 5700 Waqas 5700 SELECT Customer, SUM(OrderPrice) FROM Orders GROUP BY Customer GROUP BY Customer;

Slide 11 The INSERT INTO Statement

Slide 13

It is possible to write the INSERT INTO

statement in two Ways.

The first form doesn't specify the column names where the data will be inserted, only their values:

INSERT INTO table_name

VALUES (value1, value2, value3,...)

Slide 14

It is possible to write the INSERT INTO

statement in two Ways.

The second form specifies both the column

names and the values to be inserted:

INSERT INTO table_name (column1, column2, column3,...) VALUES (value1, value2, value3,...)

Slide 16 Now we want to insert a new row in the "Persons" table. P_Id LastName FirstName Address City 1 Ali Hassan 10H/555 Wah 2 Umer Kiyani basti Wah 3 Hamid shafiq CB-4545 Wah 4 Shoaib Akhtar I-8,st-2/ 45 ISL INSERT INTO Persons VALUES (4,‘Shoaib', ‘Akhtar', ‘I-8,st-2/ 45', ‘ISL')