












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
This lecture was delivered by Akash Singh at Biju Patnaik University of Technology, Rourkela for Introduction to Computing course. It includes: Structured, Query, Language, Information, Database, Condition, Algorithm, Comparison, Display, Order
Typology: Slides
1 / 20
This page cannot be seen from the preview
Don't miss anything!













Introduction to SQL
Basic structure of an SQL query General Structure SELECT, ALL / DISTINCT, *, AS, FROM, WHERE Comparison IN, BETWEEN, LIKE "% _" Grouping GROUP BY, HAVING, COUNT( ), SUM( ), AVG( ), MAX( ), MIN( ) Display Order ORDER BY, ASC / DESC Logical Operators AND, OR, NOT Output INTO TABLE / CURSOR TO FILE [ADDITIVE], TO PRINTER, TO SCREEN Union UNION
General Structure
General Structure
General Structure
SELECT name, hcode, class FROM student ; WHERE class="1A" Class 1A 1A 1A 1B 1B :
Class 1A 1A 1A 1B 1B :
General Structure name hcode class Peter R 1A Mary Y 1A Johnny G 1A Luke G 1A Bobby B 1A Aaron R 1A : : :
General Structure
SELECT name, id, class FROM student ; WHERE class="1A" AND NOT remission name id class Peter 9801 1A Mary 9802 1A Luke 9810 1A Bobby 9811 1A Aaron 9812 1A Ron 9813 1A Gigi 9824 1A : : :
Comparison expr IN ( value1 , value2 , value3 ) expr BETWEEN value1 AND value expr LIKE "%_"
Comparison
SELECT name, class, dob FROM student ; WHERE MONTH(dob) NOT IN (1,3,6,9) name class dob Wendy 1B 07/09/ Tobe 1B 10/17/ Eric 1C 05/05/ Patty 1C 08/13/ Kevin 1C 11/21/ Bobby 1A 02/16/ Aaron 1A 08/02/ : : :
Comparison
SELECT name, mtest FROM student ; WHERE class="1A" AND ; mtest BETWEEN 80 AND 90 name mtest Luke 86 Aaron 83 Gigi 84
Comparison
SELECT name, class, hcode FROM student ; WHERE name LIKE "_a%" AND hcode="R" name class hcode Aaron 1A R Janet 1B R Paula 2A R
Display Order SELECT ...... FROM ...... WHERE ...... GROUP BY ..... ; ORDER BY colname ASC / DESC