0% found this document useful (0 votes)
14 views4 pages

Retriving Data

The document provides an overview of SQL SELECT clauses for retrieving data from a database, specifically focusing on a player table that includes player details. It explains how to select specific columns, all columns, and specific rows using the WHERE clause, along with examples for each case. Additionally, it includes a section encouraging users to practice SQL queries on an employee table.

Uploaded by

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

Retriving Data

The document provides an overview of SQL SELECT clauses for retrieving data from a database, specifically focusing on a player table that includes player details. It explains how to select specific columns, all columns, and specific rows using the WHERE clause, along with examples for each case. Additionally, it includes a section encouraging users to practice SQL queries on an employee table.

Uploaded by

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

10/2/24, 7:08 PM Revolutionizing the Job Market | NxtWave

Retrieving Data
SELECT clause is used to retrieve data from the table.

Database
The database consists of a

player table that stores the details of players who are a part of a tournament. player table
stores the name, age and score of players.

Let's explore more about the SELECT clause using the database!

Selecting Specific Columns

To retrieve the data of only specific columns from a table, add the respective column names in
the SELECT clause.

Syntax
SQL

1 SELECT
2 column1,
3 column2,
4 ...,
5 columnN
6 FROM
7 table_name;

Example

Let's fetch the

name and age of the players from the player table.


SQL

1 SELECT
https://learning.ccbp.in/course?c_id=5d03f5a4-a285-4e52-8a57-18f718c4859f&t_id=5b2c32ee-9e6e-49ba-bcda-339076b98b69&s_id=98454b36-… 1/4
10/2/24, 7:08 PM Revolutionizing the Job Market | NxtWave
2 name,
3 age
4 FROM
5 player;

Output

name age

Virat 32

Rakesh 39

Sai 47

--- ---

Selecting All Columns

Sometimes, we may want to select all the columns from a table. Typing out every column
name, for every time we have to retrive the data, would be a pain.
We have a shortcut for this!

Syntax
SQL

1 SELECT *
2 FROM table_name;

Example

Get all the data of players from the

player table.
SQL

1 SELECT *
2 FROM player;

https://learning.ccbp.in/course?c_id=5d03f5a4-a285-4e52-8a57-18f718c4859f&t_id=5b2c32ee-9e6e-49ba-bcda-339076b98b69&s_id=98454b36-… 2/4
10/2/24, 7:08 PM Revolutionizing the Job Market | NxtWave
Output

name age score

Virat 32 50

Rakesh 39 35

Sai 47 30

--- --- ---

Selecting Specific Rows

We use WHERE clause to retrieve only specific rows.

Syntax
SQL

1 SELECT *
2 FROM table_name
3 WHERE condition;

WHERE clause specifies a condition that has to be satisfied for retrieving the data from a
database.

Example

Get

name and age of the player whose name is "Sai" from the player table.
SQL

1 SELECT name, age


2 FROM player
3 WHERE name = "Sai";

Output

https://learning.ccbp.in/course?c_id=5d03f5a4-a285-4e52-8a57-18f718c4859f&t_id=5b2c32ee-9e6e-49ba-bcda-339076b98b69&s_id=98454b36-… 3/4
10/2/24, 7:08 PM Revolutionizing the Job Market | NxtWave

name age

Sai 47

Try it Yourself!

The database consists of an

employee table that stores the employee_id , name and salary of employees. Let's
fetch data for the following queries.

1. Get all the data from the employee table.


2. Get name and salary of all the employees from the employee table.
3. Get employee_id and salary whose name is "Raju" from the employee table.

https://learning.ccbp.in/course?c_id=5d03f5a4-a285-4e52-8a57-18f718c4859f&t_id=5b2c32ee-9e6e-49ba-bcda-339076b98b69&s_id=98454b36-… 4/4

You might also like