Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
68 views

Net Database SQL 10

This document provides an introduction and overview of SQL (Structured Query Language). It outlines the key components of a basic SELECT statement including the SELECT, FROM, and WHERE clauses. It then provides examples of SELECT statements to retrieve data from tables based on different conditions, operators, and functions. Specifically, it demonstrates how to use comparison operators (> < =), the BETWEEN operator, IN to specify multiple values, and SELECT * to return all columns. The goal is for readers to understand the basic syntax of a SELECT statement and be able to write SQL queries to interrogate and retrieve data from database tables.

Uploaded by

api-238491015
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views

Net Database SQL 10

This document provides an introduction and overview of SQL (Structured Query Language). It outlines the key components of a basic SELECT statement including the SELECT, FROM, and WHERE clauses. It then provides examples of SELECT statements to retrieve data from tables based on different conditions, operators, and functions. Specifically, it demonstrates how to use comparison operators (> < =), the BETWEEN operator, IN to specify multiple values, and SELECT * to return all columns. The goal is for readers to understand the basic syntax of a SELECT statement and be able to write SQL queries to interrogate and retrieve data from database tables.

Uploaded by

api-238491015
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

What does SQL do?

Introduction to the SQL


language

Lesson Outcomes
All of you will be able to describe and recall
the syntax involved with a select command
All of you will use=
1. Select*
2. In
3. Between
4. Revise comparison operators
5. Revise boolean operators
. Most of you will be able to create commands
in order to interogate data within tables

Recap

Working on little databases


is kids stuf

SQL

Structured
Query
Language

The structure

SELECT FROM
WHERE

The structure
<Tablename(s
)>

SELE FROM WHER


CT
E
<condition>

<ColumnNam
e(s)>

The structure of a select command

<Tablename(s
)>

SELE FROM WHER


CT
E
<condition>

<ColumnNam
e(s)>

SELECT <ColumnName(s)> FROM <TableName> WHERE


<condition>

Boring tedious warning


All programs and applications may have
slight variations on the syntax of SQL

We will go by what Edexcel are referring


to(It will be just a standard version)
You need to be able to interpret what
they are asking you

First example
Open the database document: Marksheet
SELECT Name FROM Marksheet WHERE
Assign1 > 50
What would you expect as a result?

First example
Name
Aisha
Katharine
Fiona
Gareth
Manjit
Ubaid
Gemma
Alex
Philip

Second example
Open the database document: Marksheet
SELECT Name, Average FROM Marksheet WHERE
Average > 0 AND Average < 65

SELECT Name, Assign1, Assign2, Assign3 FROM


Marksheet WHERE Assign1 <= 40 AND Assign2 <= 40
AND Assign3 <= 40

SELECT Name FROM Marksheet WHERE Assign1 < 50


OR Assign2 < 50 OR Assign3 < 50
What would you expect as a result?

Second example

Using = Select*
SELECT * FROM Marksheet WHERE Average > 70

What does the *


represent?

Second example

Using = Select*
SELECT * FROM Marksheet WHERE Average > 70
Name

Assign1

Assign2

Assign3

Average

Fiona

100

87

72

86

Gareth

86

65

69

73

Philip

90

86

85

87

Second example

Using = IN
SELECT Name, Average WHERE IN (Aisha ,Jo , Mark ,
Shan) gives

IN Specifies multiple
values

Second example

Using = IN
SELECT Name, Average FROM Marksheet WHERE IN
(Aisha ,Jo , Mark , Shan) gives

IN Specifies multiple
Name
Averag
e
values
Aisha
Jo
Mark

58
45
13

Second example

Using = BETWEEN
SELECT * FROM Marksheet WHERE Average BETWEEN
60 AND 75

Second example

Using = BETWEEN
SELECT * FROM Marksheet WHERE Average BETWEEN
60 AND 75
Name
Assign1
Assign2
Assign3
Average

Katharine 75

76

48

70

Gareth

86

65

69

73

Manjit

66

64

68

66

Gemma

52

78

78

69

Really good, try it!

http://sqlzoo.n
et/

You might also like