0% found this document useful (0 votes)
60 views2 pages

En - SELECT Statement

This document discusses using SELECT statements to retrieve data from relational database tables. It explains that SELECT statements are used to read and modify data, and outputs a result set when executed. The basic syntax of a SELECT statement is SELECT * FROM tablename. Additional clauses like WHERE can be used to filter the result set by specifying a predicate condition. Common comparison operators in the WHERE clause include equal to, greater than, less than, and not equal to. By the end, the reader will understand how to retrieve specific data fields from a table and restrict results using predicates and comparison operators.

Uploaded by

Mukul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views2 pages

En - SELECT Statement

This document discusses using SELECT statements to retrieve data from relational database tables. It explains that SELECT statements are used to read and modify data, and outputs a result set when executed. The basic syntax of a SELECT statement is SELECT * FROM tablename. Additional clauses like WHERE can be used to filter the result set by specifying a predicate condition. Common comparison operators in the WHERE clause include equal to, greater than, less than, and not equal to. By the end, the reader will understand how to retrieve specific data fields from a table and restrict results using predicates and comparison operators.

Uploaded by

Mukul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Hello, and welcome to retrieving data with the SELECT statement.

In this video we will learn about retrieving data from a relational database table
by selecting
columns of a table.
At the end of this lesson, you will be able to retrieve data from a relational
database
table, define the use of a predicate, identify the syntax of the SELECT statement
using the
WHERE clause, and list the comparison operators supported by a relational database
management
system.
The main purpose of a database management system is not just to store the data, but
also facilitate retrieval of the data.
So, after creating a relational database table and inserting data into the table,
we want
to see the data.
To see the data, we use the SELECT statement.
The SELECT statement is a Data Manipulation Language statement.
Data Manipulation Language statements, or DML statements, are used to read and
modify
data.
The SELECT statement is called a query, and the output we get from executing this
query
is called a Result Set or a Result Table.
In its simplest form, a SELECT statement is: select * from tablename
Based on the Book entity example, we would create the table using the Entity name
Book,
and the Entity attributes as the columns of the table.
The data would be added to the Book table by adding rows to the table using the
INSERT
statement.
In the Book entity example, select * from book gives a result set of four rows.
All the data rows for all columns in the Book table are displayed.
In addition, you can also retrieve all the rows for all columns by specifying the
column
names individually in the select statement.
You don't always have to retrieve all the columns in a table.
You can retrieve just a subset of columns.
If you want, you can retrieve just two columns from the table Book, for example
book_id and
title.
In this case, the select statement is, SELECT book_id, title from book.
In this case, only the two columns display for each of the four rows.
Also notice that the order of the columns displayed always matches the order in the
SELECT statement.
However, what if we want to know the title of the book whose book_id is B1?
Relational operation helps us in restricting the result set by allowing us to use
the clause
"where".
The "Where" clause always requires a predicate.
A predicate is a condition that evaluates to true, false or unknown.
Predicates are used in the search condition of the Where clause.
So, if we need to know the title of the book whose book_id is B1, we use the where
clause
with the predicate book_id equals B1.
Select book_ID, title from Book Where book_ID = B1.
Notice that the result set is now restricted to just one row whose condition
evaluates
to true.
The previous example used the comparison operator "equal to" in the Where clause.
There are other comparison operators supported by a relational database management
system:
Equal to, Greater than, Less than, Greater than or equal to, Less than or equal to,
and,
Not equal to
Now you can retrieve data and select columns from a relational database table,
define the
use of a predicate, identify the syntax of the SELECT statement using the WHERE
clause,
and list the comparison operators supported by a relational database management
system.
Thanks for watching this video.

You might also like