Retriving Data
Retriving Data
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!
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
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
--- ---
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
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
Virat 32 50
Rakesh 39 35
Sai 47 30
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
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!
employee table that stores the employee_id , name and salary of employees. Let's
fetch data for the following queries.
https://learning.ccbp.in/course?c_id=5d03f5a4-a285-4e52-8a57-18f718c4859f&t_id=5b2c32ee-9e6e-49ba-bcda-339076b98b69&s_id=98454b36-… 4/4