Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Database Management System Lecture 28: Select Statement and Expression, Slides of Introduction to Database Management Systems

A portion of a database management system lecture from docsity.com. It covers the use of the select statement for querying data from one or more tables, including the use of aliases, expressions, and the distinct keyword. Examples are provided for selecting specific columns, rows, and calculating total marks.

Typology: Slides

2011/2012

Uploaded on 11/03/2012

dharmaraaj
dharmaraaj 🇮🇳

4.4

(65)

153 documents

1 / 26

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Database
Management
System
Lecture - 28
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a

Partial preview of the text

Download Database Management System Lecture 28: Select Statement and Expression and more Slides Introduction to Database Management Systems in PDF only on Docsity!

Database

Management

System

Lecture - 28

Insert

COURSE (crCode, crName, crCredits, prName)

INSERT INTO course VALUES (‘CS-211', ‘Operating Systems’, 4, ‘MCS’) INSERT INTO course (crCode, crName) VALUES (‘CS-316’, Database Systems’) INSERT INTO course (‘MG-103’, ‘Intro to Management’, NULL, NULL)

Select Statement Maximum used command in DML Used not only to select certain rows but also the columns Also used for different forms of product, that is, different joins

Select Selecting rows from one or more tables SELECT {*|col_name[,….n]} FROM table_name

Select Q: Give the names of the students with the program name SELECT stName, prName FROM student

Attribute Alias

Another Name “Urf” for an attribute SELECT {*|col_name [[AS] alias] [, …n]} FROM tab_name SELECT stName as ‘Student Name’ , prName ‘Program’ FROM Student

Expression Example Q: Display the total sessional marks of each student obtained in each subject Select stId, crCode, mTerm + sMrks ‘Total out of 50’ from enroll

Select Distinct The DISTINCT keyword is used to return only distinct (different) values

Q: Get the program names in which students are enrolled SELECT prName FROM Student Select Distinct