Database Management System: SQL Query Basics, Slides of Introduction to Database Management Systems

An introduction to sql queries, covering topics such as select statements, search conditions (not, and, or, in, like, between), and the order by clause. Examples are given to help illustrate each concept.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

dharmaraaj
dharmaraaj 🇮🇳

4.4

(68)

145 documents

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Database
Management
System
Lecture - 29
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Database Management System: SQL Query Basics and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Database

Management

System

Lecture - 29

Where: Format

SELECT [ALL|DISTINCT]

{*|culumn_list [alias][,…..n]}

FROM table_name

[WHERE <search_condition>]

Where Example

Q: Display all courses of the MCS

program

Select crCode, crName, prName

from course

where prName = ‘MCS’

Not Operator

Inverses the predicate’s value

Q: List the course names offered to

programs other than MCS

SELECT crCode, crName, prName

FROM course

WHERE not (prName = ‘MCS’)

The BETWEEN Operator

Checks the value in a range
Q: List the IDs of the students with course
codes having marks between 70 and 80
SELECT stId, crCode, totMrks
From ENROLL
WHERE totMrks between 70 and 80

SELECT crName, prName

From course

Where (prName = ‘MCS’) OR

(prName = ‘BCS’)

“Order By” Clause

Sorts the rows in a particular order

SELECT select_list
FROM table_source
[ WHERE search_condition ]
[ ORDER BY order_expression [ ASC | DESC ]
[,……n]
]